Skip to content

Commit 9d7f55b

Browse files
committed
immutable
1 parent 54755f2 commit 9d7f55b

File tree

1 file changed

+4
-3
lines changed
  • x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data

1 file changed

+4
-3
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/ElementType.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
import org.elasticsearch.TransportVersions;
1212
import org.elasticsearch.common.io.stream.StreamInput;
1313
import org.elasticsearch.common.io.stream.StreamOutput;
14-
import org.elasticsearch.common.util.Maps;
1514

1615
import java.io.IOException;
16+
import java.util.Arrays;
1717
import java.util.Map;
18+
import java.util.function.Function;
19+
import java.util.stream.Collectors;
1820

1921
/**
2022
* The type of elements in {@link Block} and {@link Vector}
@@ -110,11 +112,10 @@ public String pascalCaseName() {
110112

111113
static {
112114
ElementType[] values = values();
113-
fromLegacyNames = Maps.newMapWithExpectedSize(values.length);
114115
for (int i = 0; i < values.length; i++) {
115116
assert values[i].writableCode == i;
116-
fromLegacyNames.put(values[i].legacyWritableName, values[i]);
117117
}
118+
fromLegacyNames = Arrays.stream(values).collect(Collectors.toUnmodifiableMap(e -> e.legacyWritableName, Function.identity()));
118119
}
119120

120121
/**

0 commit comments

Comments
 (0)