mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 16:15:16 +00:00
[jdk16] Suddenly, Stream has a default method toList :-)
This commit is contained in:
1 parent
251b7541b7
commit
334167bd22
3 files changed
+6
-6
No files matched your search
@@ -21,7 +21,7 @@ import lombok.experimental.ExtensionMethod;
|
||||
consumer[i].accept(o);
|
||||
}
|
||||
}
|
||||
public static <T>List<T> toList(Stream<T> stream) {
|
||||
public static <T>List<T> toList1(Stream<T> stream) {
|
||||
return (List<T>) stream.collect(Collectors.toList());
|
||||
}
|
||||
public static <T, U>List<U> toList2(Stream<T> stream) {
|
||||
@@ -36,7 +36,7 @@ import lombok.experimental.ExtensionMethod;
|
||||
test = ExtensionMethodFunctional.Extensions.map(test, (<no type> s) -> ExtensionMethodFunctional.Extensions.reverse(s));
|
||||
ExtensionMethodFunctional.Extensions.consume(test, (<no type> s) -> System.out.println(("1: " + s)), (<no type> s) -> System.out.println(("2: " + s)));
|
||||
ExtensionMethodFunctional.Extensions.consume(test, System.out::println, System.out::println);
|
||||
ExtensionMethodFunctional.Extensions.toList(Stream.of("a", "b", "c").map(String::toUpperCase));
|
||||
ExtensionMethodFunctional.Extensions.toList1(Stream.of("a", "b", "c").map(String::toUpperCase));
|
||||
List<Integer> i2 = ExtensionMethodFunctional.Extensions.toList2(Stream.of("a", "b", "c").map(String::toUpperCase));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user