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