Remove more wildcards in Collector
This commit is contained in:
parent
1facf55ccc
commit
a29be33ac7
@ -523,7 +523,7 @@ public final class Collectors {
|
||||
* @since 9
|
||||
*/
|
||||
public static <T, A, R>
|
||||
Collector<T, ?, R> filtering(Predicate<? super T> predicate,
|
||||
Collector<T, A, R> filtering(Predicate<? super T> predicate,
|
||||
Collector<? super T, A, R> downstream) {
|
||||
BiConsumer<A, ? super T> downstreamAccumulator = downstream.accumulator();
|
||||
return new CollectorImpl<>(downstream.supplier(),
|
||||
@ -588,7 +588,7 @@ public final class Collectors {
|
||||
* @param <T> the type of the input elements
|
||||
* @return a {@code Collector} that counts the input elements
|
||||
*/
|
||||
public static <T> Collector<T, ?, Long>
|
||||
public static <T> Collector<T, long[], Long>
|
||||
counting() {
|
||||
return summingLong(e -> 1L);
|
||||
}
|
||||
@ -640,7 +640,7 @@ public final class Collectors {
|
||||
* @param mapper a function extracting the property to be summed
|
||||
* @return a {@code Collector} that produces the sum of a derived property
|
||||
*/
|
||||
public static <T> Collector<T, ?, Integer>
|
||||
public static <T> Collector<T, int[], Integer>
|
||||
summingInt(ToIntFunction<? super T> mapper) {
|
||||
return new CollectorImpl<>(
|
||||
() -> new int[1],
|
||||
@ -658,7 +658,7 @@ public final class Collectors {
|
||||
* @param mapper a function extracting the property to be summed
|
||||
* @return a {@code Collector} that produces the sum of a derived property
|
||||
*/
|
||||
public static <T> Collector<T, ?, Long>
|
||||
public static <T> Collector<T, long[], Long>
|
||||
summingLong(ToLongFunction<? super T> mapper) {
|
||||
return new CollectorImpl<>(
|
||||
() -> new long[1],
|
||||
@ -683,7 +683,7 @@ public final class Collectors {
|
||||
* @param mapper a function extracting the property to be summed
|
||||
* @return a {@code Collector} that produces the sum of a derived property
|
||||
*/
|
||||
public static <T> Collector<T, ?, Double>
|
||||
public static <T> Collector<T, double[], Double>
|
||||
summingDouble(ToDoubleFunction<? super T> mapper) {
|
||||
/*
|
||||
* In the arrays allocated for the collect operation, index 0
|
||||
@ -751,7 +751,7 @@ public final class Collectors {
|
||||
* @return a {@code Collector} that produces the arithmetic mean of a
|
||||
* derived property
|
||||
*/
|
||||
public static <T> Collector<T, ?, Double>
|
||||
public static <T> Collector<T, long[], Double>
|
||||
averagingInt(ToIntFunction<? super T> mapper) {
|
||||
return new CollectorImpl<>(
|
||||
() -> new long[2],
|
||||
@ -770,7 +770,7 @@ public final class Collectors {
|
||||
* @return a {@code Collector} that produces the arithmetic mean of a
|
||||
* derived property
|
||||
*/
|
||||
public static <T> Collector<T, ?, Double>
|
||||
public static <T> Collector<T, long[], Double>
|
||||
averagingLong(ToLongFunction<? super T> mapper) {
|
||||
return new CollectorImpl<>(
|
||||
() -> new long[2],
|
||||
@ -802,7 +802,7 @@ public final class Collectors {
|
||||
* @return a {@code Collector} that produces the arithmetic mean of a
|
||||
* derived property
|
||||
*/
|
||||
public static <T> Collector<T, ?, Double>
|
||||
public static <T> Collector<T, double[], Double>
|
||||
averagingDouble(ToDoubleFunction<? super T> mapper) {
|
||||
/*
|
||||
* In the arrays allocated for the collect operation, index 0
|
||||
@ -844,7 +844,7 @@ public final class Collectors {
|
||||
* @see #reducing(BinaryOperator)
|
||||
* @see #reducing(Object, Function, BinaryOperator)
|
||||
*/
|
||||
public static <T> Collector<T, ?, T>
|
||||
public static <T> Collector<T, T[], T>
|
||||
reducing(T identity, BinaryOperator<T> op) {
|
||||
return new CollectorImpl<>(
|
||||
boxSupplier(identity),
|
||||
@ -998,7 +998,7 @@ public final class Collectors {
|
||||
* @see #groupingBy(Function, Supplier, Collector)
|
||||
* @see #groupingByConcurrent(Function)
|
||||
*/
|
||||
public static <T, K> Collector<T, ?, Map<K, List<T>>>
|
||||
public static <T, K> Collector<T, Map<K,ArrayList<Object>>, Map<K, List<T>>>
|
||||
groupingBy(Function<? super T, ? extends K> classifier) {
|
||||
return groupingBy(classifier, toList());
|
||||
}
|
||||
@ -1048,7 +1048,7 @@ public final class Collectors {
|
||||
* @see #groupingByConcurrent(Function, Collector)
|
||||
*/
|
||||
public static <T, K, A, D>
|
||||
Collector<T, ?, Map<K, D>> groupingBy(Function<? super T, ? extends K> classifier,
|
||||
Collector<T, Map<K,A>, Map<K, D>> groupingBy(Function<? super T, ? extends K> classifier,
|
||||
Collector<? super T, A, D> downstream) {
|
||||
return groupingBy(classifier, HashMap::new, downstream);
|
||||
}
|
||||
@ -1165,7 +1165,7 @@ public final class Collectors {
|
||||
* @see #groupingByConcurrent(Function, Supplier, Collector)
|
||||
*/
|
||||
public static <T, K>
|
||||
Collector<T, ?, ConcurrentMap<K, List<T>>>
|
||||
Collector<T, ConcurrentMap<K,ArrayList<Object>>, ConcurrentMap<K, List<T>>>
|
||||
groupingByConcurrent(Function<? super T, ? extends K> classifier) {
|
||||
return groupingByConcurrent(classifier, ConcurrentHashMap::new, toList());
|
||||
}
|
||||
@ -1211,7 +1211,7 @@ public final class Collectors {
|
||||
* @see #groupingByConcurrent(Function, Supplier, Collector)
|
||||
*/
|
||||
public static <T, K, A, D>
|
||||
Collector<T, ?, ConcurrentMap<K, D>> groupingByConcurrent(Function<? super T, ? extends K> classifier,
|
||||
Collector<T, ConcurrentMap<K,A>, ConcurrentMap<K, D>> groupingByConcurrent(Function<? super T, ? extends K> classifier,
|
||||
Collector<? super T, A, D> downstream) {
|
||||
return groupingByConcurrent(classifier, ConcurrentHashMap::new, downstream);
|
||||
}
|
||||
@ -1475,7 +1475,7 @@ public final class Collectors {
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static <T, K, U>
|
||||
Collector<T, ?, Map<K,U>> toUnmodifiableMap(Function<? super T, ? extends K> keyMapper,
|
||||
Collector<T, Map<K,U>, Map<K,U>> toUnmodifiableMap(Function<? super T, ? extends K> keyMapper,
|
||||
Function<? super T, ? extends U> valueMapper) {
|
||||
Objects.requireNonNull(keyMapper, "keyMapper");
|
||||
Objects.requireNonNull(valueMapper, "valueMapper");
|
||||
@ -1541,7 +1541,7 @@ public final class Collectors {
|
||||
* @see #toConcurrentMap(Function, Function, BinaryOperator)
|
||||
*/
|
||||
public static <T, K, U>
|
||||
Collector<T, ?, Map<K,U>> toMap(Function<? super T, ? extends K> keyMapper,
|
||||
Collector<T, Map<K,U>, Map<K,U>> toMap(Function<? super T, ? extends K> keyMapper,
|
||||
Function<? super T, ? extends U> valueMapper,
|
||||
BinaryOperator<U> mergeFunction) {
|
||||
return toMap(keyMapper, valueMapper, mergeFunction, HashMap::new);
|
||||
@ -1581,7 +1581,7 @@ public final class Collectors {
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static <T, K, U>
|
||||
Collector<T, ?, Map<K,U>> toUnmodifiableMap(Function<? super T, ? extends K> keyMapper,
|
||||
Collector<T, Map<K,U>, Map<K,U>> toUnmodifiableMap(Function<? super T, ? extends K> keyMapper,
|
||||
Function<? super T, ? extends U> valueMapper,
|
||||
BinaryOperator<U> mergeFunction) {
|
||||
Objects.requireNonNull(keyMapper, "keyMapper");
|
||||
@ -1633,7 +1633,7 @@ public final class Collectors {
|
||||
* @see #toConcurrentMap(Function, Function, BinaryOperator, Supplier)
|
||||
*/
|
||||
public static <T, K, U, M extends Map<K, U>>
|
||||
Collector<T, ?, M> toMap(Function<? super T, ? extends K> keyMapper,
|
||||
Collector<T, M, M> toMap(Function<? super T, ? extends K> keyMapper,
|
||||
Function<? super T, ? extends U> valueMapper,
|
||||
BinaryOperator<U> mergeFunction,
|
||||
Supplier<M> mapFactory) {
|
||||
@ -1696,7 +1696,7 @@ public final class Collectors {
|
||||
* @see #toConcurrentMap(Function, Function, BinaryOperator, Supplier)
|
||||
*/
|
||||
public static <T, K, U>
|
||||
Collector<T, ?, ConcurrentMap<K,U>> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
|
||||
Collector<T, Map<K,U>, ConcurrentMap<K,U>> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
|
||||
Function<? super T, ? extends U> valueMapper) {
|
||||
return new CollectorImpl<>(ConcurrentHashMap::new,
|
||||
uniqKeysMapAccumulator(keyMapper, valueMapper),
|
||||
@ -1797,7 +1797,7 @@ public final class Collectors {
|
||||
* @see #toMap(Function, Function, BinaryOperator, Supplier)
|
||||
*/
|
||||
public static <T, K, U, M extends ConcurrentMap<K, U>>
|
||||
Collector<T, ?, M> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
|
||||
Collector<T, M, M> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
|
||||
Function<? super T, ? extends U> valueMapper,
|
||||
BinaryOperator<U> mergeFunction,
|
||||
Supplier<M> mapFactory) {
|
||||
@ -1820,7 +1820,7 @@ public final class Collectors {
|
||||
* @see #summarizingLong(ToLongFunction)
|
||||
*/
|
||||
public static <T>
|
||||
Collector<T, ?, IntSummaryStatistics> summarizingInt(ToIntFunction<? super T> mapper) {
|
||||
Collector<T, IntSummaryStatistics, IntSummaryStatistics> summarizingInt(ToIntFunction<? super T> mapper) {
|
||||
return new CollectorImpl<>(
|
||||
IntSummaryStatistics::new,
|
||||
(r, t) -> r.accept(mapper.applyAsInt(t)),
|
||||
@ -1843,7 +1843,7 @@ public final class Collectors {
|
||||
* @see #summarizingInt(ToIntFunction)
|
||||
*/
|
||||
public static <T>
|
||||
Collector<T, ?, LongSummaryStatistics> summarizingLong(ToLongFunction<? super T> mapper) {
|
||||
Collector<T, LongSummaryStatistics, LongSummaryStatistics> summarizingLong(ToLongFunction<? super T> mapper) {
|
||||
return new CollectorImpl<>(
|
||||
LongSummaryStatistics::new,
|
||||
(r, t) -> r.accept(mapper.applyAsLong(t)),
|
||||
@ -1866,7 +1866,7 @@ public final class Collectors {
|
||||
* @see #summarizingInt(ToIntFunction)
|
||||
*/
|
||||
public static <T>
|
||||
Collector<T, ?, DoubleSummaryStatistics> summarizingDouble(ToDoubleFunction<? super T> mapper) {
|
||||
Collector<T, DoubleSummaryStatistics, DoubleSummaryStatistics> summarizingDouble(ToDoubleFunction<? super T> mapper) {
|
||||
return new CollectorImpl<>(
|
||||
DoubleSummaryStatistics::new,
|
||||
(r, t) -> r.accept(mapper.applyAsDouble(t)),
|
||||
|
Loading…
Reference in New Issue
Block a user