Remove further wildcards from Collectors
This commit is contained in:
parent
7c06bd67df
commit
bc4d7d1bc9
@ -245,24 +245,6 @@ public final class Collectors {
|
||||
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 <T> 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 <T>
|
||||
Collector<T, ArrayList<Object>, List<T>> toList2() {
|
||||
return new CollectorImpl<>(ArrayList::new, List::add,
|
||||
(left, right) -> { left.addAll(right); return left; },
|
||||
CH_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@code Collector} that accumulates the input elements into an
|
||||
* <a href="../List.html#unmodifiable">unmodifiable List</a> in encounter
|
||||
@ -922,9 +904,8 @@ public final class Collectors {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new CollectorImpl<>(
|
||||
OptionalBox::new, OptionalBox::accept,
|
||||
OptionalBox::new, Consumer<T>::accept,
|
||||
(a, b) -> {
|
||||
if (b.present) a.accept(b.value);
|
||||
return a;
|
||||
@ -970,7 +951,7 @@ public final class Collectors {
|
||||
* @see #reducing(BinaryOperator)
|
||||
*/
|
||||
public static <T, U>
|
||||
Collector<T, ?, U> reducing(U identity,
|
||||
Collector<T, U[], U> reducing(U identity,
|
||||
Function<? super T, ? extends U> mapper,
|
||||
BinaryOperator<U> op) {
|
||||
return new CollectorImpl<>(
|
||||
|
Loading…
Reference in New Issue
Block a user