Hi,

at least the code snippet you given has no inconsistency problem, I think.
But if "measurementSchemaList" is not usable, we can remove it.

What is more, I notice that you have removed it in some PR, but does not
report it on the JIRA. You'd better maintain the status of the issue on
JIRA.

Best,
-----------------------------------
Xiangdong Huang
School of Software, Tsinghua University

 黄向东
清华大学 软件学院


Yuan Tian (Jira) <[email protected]> 于2019年9月3日周二 下午3:35写道:

> Yuan Tian created IOTDB-194:
> -------------------------------
>
>              Summary: Redundant field 'measurementSchemaList' in
> Schema.java
>                  Key: IOTDB-194
>                  URL: https://issues.apache.org/jira/browse/IOTDB-194
>              Project: Apache IoTDB
>           Issue Type: Improvement
>             Reporter: Yuan Tian
>
>
> There are two fields in Schema.java, 'measurementSchemaMap' and
> 'measurementSchemaList'. I don't understand the meaning of the existence of
> the 'measurementSchemaList' in Schema.java. If we use the following
> constructor and there are repetitive measurement_id in the list, this will
> cause the inconsistency of the above two fields.
> {code:java}
> private Map<String, MeasurementSchema> measurementSchemaMap;
> private List<MeasurementSchema> measurementSchemaList;
> public Schema(List<MeasurementSchema> measurements) {
>     this();
>     this.registerMeasurements(measurements);
> }
> public void registerMeasurements(List<MeasurementSchema> measurements) {
>     measurements.forEach((md) -> registerMeasurement(md));
> }
> public void registerMeasurement(MeasurementSchema descriptor) {
>     this.measurementSchemaMap.put(descriptor.getMeasurementId(),
> descriptor);
>     this.measurementSchemaList.add(descriptor);
> }
> {code}
>
> If the purpose of 'measurementSchemaList' is to maintain the insertion
> order of the measurements, why not use LinkedHashMap, then the order of
> map.values() is certain.
>
>
>
>
>
>
>
> --
> This message was sent by Atlassian Jira
> (v8.3.2#803003)
>

Reply via email to