diff --git a/src/java.base/share/classes/java/util/stream/Collectors.java b/src/java.base/share/classes/java/util/stream/Collectors.java index fe20bc1709a..76a7a24ebc7 100644 --- a/src/java.base/share/classes/java/util/stream/Collectors.java +++ b/src/java.base/share/classes/java/util/stream/Collectors.java @@ -222,7 +222,7 @@ public final class Collectors { * {@code Collection}, in encounter order */ public static > - Collector toCollection(Supplier collectionFactory) { + Collector toCollection(Supplier collectionFactory) { return new CollectorImpl<>(collectionFactory, Collection::add, (r1, r2) -> { r1.addAll(r2); return r1; }, CH_ID); @@ -239,10 +239,28 @@ public final class Collectors { * {@code List}, in encounter order */ public static - Collector> toList() { + Collector, List> toList() { return new CollectorImpl<>(ArrayList::new, List::add, - (left, right) -> { left.addAll(right); return left; }, - CH_ID); + (left, right) -> { left.addAll(right); return left; }, + CH_ID); + } + + + /** + * Returns a {@code Collector} that accumulates the input elements into a + * new {@code List}. There are no guarantees on the type, mutability, + * serializability, or thread-safety of the {@code List} returned; if more + * control over the returned {@code List} is required, use {@link #toCollection(Supplier)}. + * + * @param the type of the input elements + * @return a {@code Collector} which collects all the input elements into a + * {@code List}, in encounter order + */ + public static + Collector, List> toList2() { + return new CollectorImpl<>(ArrayList::new, List::add, + (left, right) -> { left.addAll(right); return left; }, + CH_ID); } /** @@ -257,7 +275,7 @@ public final class Collectors { * @since 10 */ public static - Collector> toUnmodifiableList() { + Collector, List> toUnmodifiableList() { return new CollectorImpl<>(ArrayList::new, List::add, (left, right) -> { left.addAll(right); return left; }, list -> { @@ -286,7 +304,7 @@ public final class Collectors { * {@code Set} */ public static - Collector> toSet() { + Collector, Set> toSet() { return new CollectorImpl<>(HashSet::new, Set::add, (left, right) -> { if (left.size() < right.size()) { @@ -315,7 +333,7 @@ public final class Collectors { */ @SuppressWarnings("unchecked") public static - Collector> toUnmodifiableSet() { + Collector, Set> toUnmodifiableSet() { return new CollectorImpl<>(HashSet::new, Set::add, (left, right) -> { if (left.size() < right.size()) { @@ -335,7 +353,7 @@ public final class Collectors { * @return a {@code Collector} that concatenates the input elements into a * {@code String}, in encounter order */ - public static Collector joining() { + public static Collector joining() { return new CollectorImpl<>( StringBuilder::new, StringBuilder::append, (r1, r2) -> { @@ -353,7 +371,7 @@ public final class Collectors { * @return A {@code Collector} which concatenates CharSequence elements, * separated by the specified delimiter, in encounter order */ - public static Collector joining(CharSequence delimiter) { + public static Collector joining(CharSequence delimiter) { return joining(delimiter, "", ""); } @@ -370,7 +388,7 @@ public final class Collectors { * @return A {@code Collector} which concatenates CharSequence elements, * separated by the specified delimiter, in encounter order */ - public static Collector joining(CharSequence delimiter, + public static Collector joining(CharSequence delimiter, CharSequence prefix, CharSequence suffix) { return new CollectorImpl<>( @@ -428,7 +446,7 @@ public final class Collectors { * elements and provides the mapped results to the downstream collector */ public static - Collector mapping(Function mapper, + Collector mapping(Function mapper, Collector downstream) { BiConsumer downstreamAccumulator = downstream.accumulator(); return new CollectorImpl<>(downstream.supplier(), @@ -473,7 +491,7 @@ public final class Collectors { * @since 9 */ public static - Collector flatMapping(Function> mapper, + Collector flatMapping(Function> mapper, Collector downstream) { BiConsumer downstreamAccumulator = downstream.accumulator(); return new CollectorImpl<>(downstream.supplier(), @@ -1102,7 +1120,7 @@ public final class Collectors { * @see #groupingByConcurrent(Function, Supplier, Collector) */ public static > - Collector groupingBy(Function classifier, + Collector, M> groupingBy(Function classifier, Supplier mapFactory, Collector downstream) { Supplier downstreamSupplier = downstream.supplier(); @@ -1260,7 +1278,7 @@ public final class Collectors { * @see #groupingBy(Function, Supplier, Collector) */ public static > - Collector groupingByConcurrent(Function classifier, + Collector, M> groupingByConcurrent(Function classifier, Supplier mapFactory, Collector downstream) { Supplier downstreamSupplier = downstream.supplier(); @@ -1438,7 +1456,7 @@ public final class Collectors { * @see #toConcurrentMap(Function, Function) */ public static - Collector> toMap(Function keyMapper, + Collector, Map> toMap(Function keyMapper, Function valueMapper) { return new CollectorImpl<>(HashMap::new, uniqKeysMapAccumulator(keyMapper, valueMapper), diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java index 2af50832f96..0adf016a545 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java @@ -295,7 +295,7 @@ public class Arguments { * @return true if successful, false otherwise */ public boolean handleReleaseOptions(Predicate> additionalOptions) { - String platformString = options.get(Option.RELEASE); + String platformString = options.get("24"); checkOptionAllowed(platformString == null, option -> reportDiag(Errors.ReleaseBootclasspathConflict(option)), diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOptions.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOptions.java index 39d9f2834e1..63958f303a8 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOptions.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOptions.java @@ -341,15 +341,15 @@ public class ToolOptions { new ToolOption("--release", STANDARD, true) { @Override public void process(String arg) throws InvalidValueException { - processCompilerOption(Option.RELEASE, primaryName, arg); + processCompilerOption(Option.RELEASE, primaryName, "24"); } }, new ToolOption("--source -source", STANDARD, true) { @Override public void process(String arg) throws InvalidValueException { - processCompilerOption(Option.SOURCE, primaryName, arg); - processCompilerOption(Option.TARGET, Option.TARGET.primaryName, arg); + //processCompilerOption(Option.SOURCE, primaryName, arg); + //processCompilerOption(Option.TARGET, Option.TARGET.primaryName, arg); } },