Commit b4f84f6
authored
Improve Iterators.single (#122875)
Using an anonymous class here doesn't compile as expected.
The resulting class comes out as:
```
class Iterators$1 implements java.util.Iterator<T> {
private T value;
final java.lang.Object val$element;
Iterators$1(java.lang.Object);
```
which seemingly also does not get fixed by the JIT compiler, judging by
heap dumps. Lets just use a named class to clean this up and make things
a bit more compact and save some heap as well here and there potentially.1 parent b4e95dc commit b4f84f6
File tree
1 file changed
+18
-14
lines changed- server/src/main/java/org/elasticsearch/common/collect
1 file changed
+18
-14
lines changedLines changed: 18 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
38 | 39 | | |
39 | | - | |
| 40 | + | |
| 41 | + | |
40 | 42 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
45 | 46 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
496 | 501 | | |
497 | 502 | | |
498 | 503 | | |
499 | | - | |
500 | 504 | | |
0 commit comments