File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
java-compiler-testing/src/main/java/io/github/ascopes/jct/utils Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 1818import static java .util .Objects .requireNonNull ;
1919
2020import java .util .ArrayList ;
21- import java .util .Arrays ;
21+ import java .util .Collections ;
2222import java .util .List ;
2323import java .util .stream .Collectors ;
2424import java .util .stream .Stream ;
@@ -53,7 +53,7 @@ public static <T> List<T> flatten(Iterable<? extends Iterable<T>> iterableOfItem
5353 flattenedItems .add (item );
5454 }
5555 }
56- return flattenedItems ;
56+ return Collections . unmodifiableList ( flattenedItems ) ;
5757 }
5858
5959 /**
@@ -69,10 +69,12 @@ public static <T> List<T> flatten(Iterable<? extends Iterable<T>> iterableOfItem
6969 */
7070 @ SafeVarargs
7171 public static <T > List <T > combineOneOrMore (T first , T ... rest ) {
72- var list = new ArrayList <T >();
72+ var list = new ArrayList <T >(1 + rest . length );
7373 list .add (first );
74- list .addAll (Arrays .asList (rest ));
75- return list ;
74+ for (var item : rest ) {
75+ list .add (item );
76+ }
77+ return Collections .unmodifiableList (list );
7678 }
7779
7880 /**
You can’t perform that action at this time.
0 commit comments