Package | Description |
---|---|
java8.util |
Provides some of the new
java.util classes and implementations of
static and default interface methods added in Java 8 and, in addition, the
JEP 269: Convenience Factory
Methods for Collections that were introduced in Java 9. |
java8.util.concurrent |
The Java 7 and Java 8 utility classes commonly used in concurrent programming.
|
java8.util.function |
Functional interfaces provide target types for lambda expressions
and method references.
|
java8.util.stream |
Classes to support functional-style operations on streams of elements, such
as map-reduce transformations on collections.
|
Modifier and Type | Method and Description |
---|---|
static <T,U extends Comparable<? super U>> |
Comparators.comparing(Function<? super T,? extends U> keyExtractor)
Accepts a function that extracts a
Comparable sort key from a type T , and returns a Comparator<T> that compares by that sort key. |
static <T,U> Comparator<T> |
Comparators.comparing(Function<? super T,? extends U> keyExtractor,
Comparator<? super U> keyComparator)
Accepts a function that extracts a sort key from a type
T , and
returns a Comparator<T> that compares by that sort key using
the specified Comparator . |
static <K,V> V |
Maps.computeIfAbsent(Map<K,V> map,
K key,
Function<? super K,? extends V> mappingFunction)
If the specified key is not already associated with a value (or is mapped
to
null ), attempts to compute its value using the given mapping
function and enters it into the passed map unless null . |
<U> Optional<U> |
Optional.flatMap(Function<? super T,? extends Optional<? extends U>> mapper)
If a value is present, returns the result of applying the given
Optional -bearing mapping function to the value, otherwise returns
an empty Optional . |
<U> Optional<U> |
Optional.map(Function<? super T,? extends U> mapper)
If a value is present, returns an
Optional describing (as if by
Optional.ofNullable(T) ) the result of applying the given mapping function to
the value, otherwise returns an empty Optional . |
static <T,U extends Comparable<? super U>> |
Comparators.thenComparing(Comparator<? super T> this_,
Function<? super T,? extends U> keyExtractor)
Returns a lexicographic-order comparator with a function that
extracts a
Comparable sort key. |
static <T,U> Comparator<T> |
Comparators.thenComparing(Comparator<? super T> this_,
Function<? super T,? extends U> keyExtractor,
Comparator<? super U> keyComparator)
Returns a lexicographic-order comparator with a function that
extracts a key to be compared with the given
Comparator . |
Modifier and Type | Method and Description |
---|---|
static <K,V> V |
ConcurrentMaps.computeIfAbsent(ConcurrentMap<K,V> map,
K key,
Function<? super K,? extends V> mappingFunction)
If the specified key is not already associated with a value (or is mapped
to
null ), attempts to compute its value using the given mapping
function and enters it into the passed map unless null . |
Modifier and Type | Interface and Description |
---|---|
interface |
UnaryOperator<T>
Represents an operation on a single operand that produces a result of the
same type as its operand.
|
Modifier and Type | Method and Description |
---|---|
static <R,T,V> Function<T,V> |
Functions.andThen(Function<? super T,? extends R> this_,
Function<? super R,? extends V> after)
Returns a composed function that first applies the
this_ function to
its input, and then applies the after function to the result. |
static <R,T,V> Function<V,R> |
Functions.compose(Function<? super T,? extends R> this_,
Function<? super V,? extends T> before)
Returns a composed function that first applies the
before
function to its input, and then applies the this_ function to the result. |
static <T> Function<T,T> |
Functions.identity()
Returns a function that always returns its input argument.
|
Modifier and Type | Method and Description |
---|---|
static <R,T,U,V> BiFunction<T,U,V> |
BiFunctions.andThen(BiFunction<? super T,? super U,? extends R> this_,
Function<? super R,? extends V> after)
Returns a composed function that first applies the
this_ function to
its inputs, and then applies the after function to the result. |
static <R,T,V> Function<T,V> |
Functions.andThen(Function<? super T,? extends R> this_,
Function<? super R,? extends V> after)
Returns a composed function that first applies the
this_ function to
its input, and then applies the after function to the result. |
static <R,T,V> Function<T,V> |
Functions.andThen(Function<? super T,? extends R> this_,
Function<? super R,? extends V> after)
Returns a composed function that first applies the
this_ function to
its input, and then applies the after function to the result. |
static <R,T,V> Function<V,R> |
Functions.compose(Function<? super T,? extends R> this_,
Function<? super V,? extends T> before)
Returns a composed function that first applies the
before
function to its input, and then applies the this_ function to the result. |
static <R,T,V> Function<V,R> |
Functions.compose(Function<? super T,? extends R> this_,
Function<? super V,? extends T> before)
Returns a composed function that first applies the
before
function to its input, and then applies the this_ function to the result. |
Modifier and Type | Method and Description |
---|---|
Function<A,R> |
Collector.finisher()
Perform the final transformation from the intermediate accumulation type
A to the final result type R . |
Modifier and Type | Method and Description |
---|---|
static <T,A,R,RR> Collector<T,A,RR> |
Collectors.collectingAndThen(Collector<T,A,R> downstream,
Function<R,RR> finisher)
Adapts a
Collector to perform an additional finishing
transformation. |
<R> Stream<R> |
Stream.flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
Returns a stream consisting of the results of replacing each element of
this stream with the contents of a mapped stream produced by applying
the provided mapping function to each element.
|
static <T,U,A,R> Collector<T,?,R> |
Collectors.flatMapping(Function<? super T,? extends Stream<? extends U>> mapper,
Collector<? super U,A,R> downstream)
Adapts a
Collector accepting elements of type U to one
accepting elements of type T by applying a flat mapping function
to each input element before accumulation. |
DoubleStream |
Stream.flatMapToDouble(Function<? super T,? extends DoubleStream> mapper)
Returns an
DoubleStream consisting of the results of replacing
each element of this stream with the contents of a mapped stream produced
by applying the provided mapping function to each element. |
IntStream |
Stream.flatMapToInt(Function<? super T,? extends IntStream> mapper)
Returns an
IntStream consisting of the results of replacing each
element of this stream with the contents of a mapped stream produced by
applying the provided mapping function to each element. |
LongStream |
Stream.flatMapToLong(Function<? super T,? extends LongStream> mapper)
Returns an
LongStream consisting of the results of replacing each
element of this stream with the contents of a mapped stream produced by
applying the provided mapping function to each element. |
static <T,K> Collector<T,?,Map<K,List<T>>> |
Collectors.groupingBy(Function<? super T,? extends K> classifier)
Returns a
Collector implementing a "group by" operation on
input elements of type T , grouping elements according to a
classification function, and returning the results in a Map . |
static <T,K,A,D> Collector<T,?,Map<K,D>> |
Collectors.groupingBy(Function<? super T,? extends K> classifier,
Collector<? super T,A,D> downstream)
Returns a
Collector implementing a cascaded "group by" operation
on input elements of type T , grouping elements according to a
classification function, and then performing a reduction operation on
the values associated with a given key using the specified downstream
Collector . |
static <T,K,D,A,M extends Map<K,D>> |
Collectors.groupingBy(Function<? super T,? extends K> classifier,
Supplier<M> mapFactory,
Collector<? super T,A,D> downstream)
Returns a
Collector implementing a cascaded "group by" operation
on input elements of type T , grouping elements according to a
classification function, and then performing a reduction operation on
the values associated with a given key using the specified downstream
Collector . |
static <T,K> Collector<T,?,ConcurrentMap<K,List<T>>> |
Collectors.groupingByConcurrent(Function<? super T,? extends K> classifier)
Returns a concurrent
Collector implementing a "group by"
operation on input elements of type T , grouping elements
according to a classification function. |
static <T,K,A,D> Collector<T,?,ConcurrentMap<K,D>> |
Collectors.groupingByConcurrent(Function<? super T,? extends K> classifier,
Collector<? super T,A,D> downstream)
Returns a concurrent
Collector implementing a cascaded "group by"
operation on input elements of type T , grouping elements
according to a classification function, and then performing a reduction
operation on the values associated with a given key using the specified
downstream Collector . |
static <T,K,A,D,M extends ConcurrentMap<K,D>> |
Collectors.groupingByConcurrent(Function<? super T,? extends K> classifier,
Supplier<M> mapFactory,
Collector<? super T,A,D> downstream)
Returns a concurrent
Collector implementing a cascaded "group by"
operation on input elements of type T , grouping elements
according to a classification function, and then performing a reduction
operation on the values associated with a given key using the specified
downstream Collector . |
<R> Stream<R> |
Stream.map(Function<? super T,? extends R> mapper)
Returns a stream consisting of the results of applying the given
function to the elements of this stream.
|
static <T,U,A,R> Collector<T,?,R> |
Collectors.mapping(Function<? super T,? extends U> mapper,
Collector<? super U,A,R> downstream)
Adapts a
Collector accepting elements of type U to one
accepting elements of type T by applying a mapping function to
each input element before accumulation. |
static <T,A,R> Collector<T,A,R> |
Collectors.of(Supplier<A> supplier,
BiConsumer<A,T> accumulator,
BinaryOperator<A> combiner,
Function<A,R> finisher,
Collector.Characteristics... characteristics)
Returns a new
Collector described by the given supplier ,
accumulator , combiner , and finisher functions. |
static <T,U> Collector<T,?,U> |
Collectors.reducing(U identity,
Function<? super T,? extends U> mapper,
BinaryOperator<U> op)
Returns a
Collector which performs a reduction of its
input elements under a specified mapping function and
BinaryOperator . |
static <T,K,U> Collector<T,?,ConcurrentMap<K,U>> |
Collectors.toConcurrentMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper)
Returns a concurrent
Collector that accumulates elements into a
ConcurrentMap whose keys and values are the result of applying
the provided mapping functions to the input elements. |
static <T,K,U> Collector<T,?,ConcurrentMap<K,U>> |
Collectors.toConcurrentMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper)
Returns a concurrent
Collector that accumulates elements into a
ConcurrentMap whose keys and values are the result of applying
the provided mapping functions to the input elements. |
static <T,K,U> Collector<T,?,ConcurrentMap<K,U>> |
Collectors.toConcurrentMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction)
Returns a concurrent
Collector that accumulates elements into a
ConcurrentMap whose keys and values are the result of applying
the provided mapping functions to the input elements. |
static <T,K,U> Collector<T,?,ConcurrentMap<K,U>> |
Collectors.toConcurrentMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction)
Returns a concurrent
Collector that accumulates elements into a
ConcurrentMap whose keys and values are the result of applying
the provided mapping functions to the input elements. |
static <T,K,U,M extends ConcurrentMap<K,U>> |
Collectors.toConcurrentMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction,
Supplier<M> mapFactory)
Returns a concurrent
Collector that accumulates elements into a
ConcurrentMap whose keys and values are the result of applying
the provided mapping functions to the input elements. |
static <T,K,U,M extends ConcurrentMap<K,U>> |
Collectors.toConcurrentMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction,
Supplier<M> mapFactory)
Returns a concurrent
Collector that accumulates elements into a
ConcurrentMap whose keys and values are the result of applying
the provided mapping functions to the input elements. |
static <T,K,U> Collector<T,?,Map<K,U>> |
Collectors.toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper)
Returns a
Collector that accumulates elements into a
Map whose keys and values are the result of applying the provided
mapping functions to the input elements. |
static <T,K,U> Collector<T,?,Map<K,U>> |
Collectors.toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper)
Returns a
Collector that accumulates elements into a
Map whose keys and values are the result of applying the provided
mapping functions to the input elements. |
static <T,K,U> Collector<T,?,Map<K,U>> |
Collectors.toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction)
Returns a
Collector that accumulates elements into a
Map whose keys and values are the result of applying the provided
mapping functions to the input elements. |
static <T,K,U> Collector<T,?,Map<K,U>> |
Collectors.toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction)
Returns a
Collector that accumulates elements into a
Map whose keys and values are the result of applying the provided
mapping functions to the input elements. |
static <T,K,U,M extends Map<K,U>> |
Collectors.toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction,
Supplier<M> mapFactory)
Returns a
Collector that accumulates elements into a
Map whose keys and values are the result of applying the provided
mapping functions to the input elements. |
static <T,K,U,M extends Map<K,U>> |
Collectors.toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction,
Supplier<M> mapFactory)
Returns a
Collector that accumulates elements into a
Map whose keys and values are the result of applying the provided
mapping functions to the input elements. |
static <T,K,U> Collector<T,?,Map<K,U>> |
Collectors.toUnmodifiableMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper)
Returns a
Collector that accumulates the input elements into an
unmodifiable Map ,
whose keys and values are the result of applying the provided
mapping functions to the input elements. |
static <T,K,U> Collector<T,?,Map<K,U>> |
Collectors.toUnmodifiableMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper)
Returns a
Collector that accumulates the input elements into an
unmodifiable Map ,
whose keys and values are the result of applying the provided
mapping functions to the input elements. |
static <T,K,U> Collector<T,?,Map<K,U>> |
Collectors.toUnmodifiableMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction)
Returns a
Collector that accumulates the input elements into an
unmodifiable Map ,
whose keys and values are the result of applying the provided
mapping functions to the input elements. |
static <T,K,U> Collector<T,?,Map<K,U>> |
Collectors.toUnmodifiableMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction)
Returns a
Collector that accumulates the input elements into an
unmodifiable Map ,
whose keys and values are the result of applying the provided
mapping functions to the input elements. |
Copyright © 2018. All rights reserved.