77
88import java .util .ArrayList ;
99import java .util .Collection ;
10- import java .util .Collections ;
1110import java .util .Iterator ;
1211import java .util .LinkedHashSet ;
1312import java .util .List ;
@@ -56,7 +55,7 @@ public ArrayValue add(String value) {
5655 }
5756
5857 @ Override
59- public ValueNode get (@ NonNull int index ) {
58+ public @ NonNull ValueNode get (int index ) {
6059 try {
6160 return list .get (index );
6261 } catch (IndexOutOfBoundsException x ) {
@@ -65,7 +64,7 @@ public ValueNode get(@NonNull int index) {
6564 }
6665
6766 @ Override
68- public ValueNode get (@ NonNull String name ) {
67+ public @ NonNull ValueNode get (@ NonNull String name ) {
6968 return new MissingValue (this .name + "." + name );
7069 }
7170
@@ -75,7 +74,7 @@ public int size() {
7574 }
7675
7776 @ Override
78- public String value () {
77+ public @ NonNull String value () {
7978 String name = name ();
8079 throw new TypeMismatchException (name == null ? getClass ().getSimpleName () : name , String .class );
8180 }
@@ -86,7 +85,7 @@ public String toString() {
8685 }
8786
8887 @ Override
89- public Iterator <ValueNode > iterator () {
88+ public @ NonNull Iterator <ValueNode > iterator () {
9089 return list .iterator ();
9190 }
9291
@@ -120,24 +119,24 @@ public <T> Set<T> toSet(@NonNull Class<T> type) {
120119 }
121120
122121 @ Override
123- public Map <String , List <String >> toMultimap () {
122+ public @ NonNull Map <String , List <String >> toMultimap () {
124123 List <String > values = new ArrayList <>();
125- list .stream (). forEach (it -> it .toMultimap ().values ().forEach (values ::addAll ));
126- return Collections . singletonMap (name , values );
124+ list .forEach (it -> it .toMultimap ().values ().forEach (values ::addAll ));
125+ return Map . of (name , values );
127126 }
128127
129128 @ Override
130- public List <String > toList () {
129+ public @ NonNull List <String > toList () {
131130 return collect (new ArrayList <>(), String .class );
132131 }
133132
134133 @ Override
135- public Set <String > toSet () {
134+ public @ NonNull Set <String > toSet () {
136135 return collect (new LinkedHashSet <>(), String .class );
137136 }
138137
139138 private <T , C extends Collection <T >> C collect (C collection , Class <T > type ) {
140- for (ValueNode node : list ) {
139+ for (var node : list ) {
141140 collection .add (node .to (type ));
142141 }
143142 return collection ;
0 commit comments