Package | Description |
---|---|
java8.util |
Provides some of the new
java.util classes and implementations
of static and default interface methods added in Java 8. |
java8.util.concurrent |
The Java 7 and Java 8 utility classes commonly used in concurrent programming.
|
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 |
---|---|
Optional<T> |
Optional.or(Supplier<Optional<T>> supplier)
If a value is present, returns an
Optional describing the value,
otherwise returns an Optional produced by the supplying function. |
T |
Optional.orElseGet(Supplier<? extends T> supplier)
If a value is present, returns the value, otherwise returns the result
produced by the supplying function.
|
<X extends Throwable> |
OptionalLong.orElseThrow(Supplier<? extends X> exceptionSupplier)
If a value is present, returns the value, otherwise throws an exception
produced by the exception supplying function.
|
<X extends Throwable> |
OptionalInt.orElseThrow(Supplier<? extends X> exceptionSupplier)
If a value is present, returns the value, otherwise throws an exception
produced by the exception supplying function.
|
<X extends Throwable> |
OptionalDouble.orElseThrow(Supplier<? extends X> exceptionSupplier)
If a value is present, returns the value, otherwise throws an exception
produced by the exception supplying function.
|
<X extends Throwable> |
Optional.orElseThrow(Supplier<? extends X> exceptionSupplier)
If a value is present, returns the value, otherwise throws an exception
produced by the exception supplying function.
|
static <T> T |
Objects.requireNonNull(T obj,
Supplier<String> messageSupplier)
Checks that the specified object reference is not
null and
throws a customized NullPointerException if it is. |
Modifier and Type | Method and Description |
---|---|
static <U> CompletableFuture<U> |
CompletableFuture.supplyAsync(Supplier<U> supplier)
Returns a new CompletableFuture that is asynchronously completed
by a task running in the
ForkJoinPool.commonPool() with
the value obtained by calling the given Supplier. |
static <U> CompletableFuture<U> |
CompletableFuture.supplyAsync(Supplier<U> supplier,
Executor executor)
Returns a new CompletableFuture that is asynchronously completed
by a task running in the given executor with the value obtained
by calling the given Supplier.
|
Modifier and Type | Method and Description |
---|---|
Supplier<A> |
Collector.supplier()
A function that creates and returns a new mutable result container.
|
Modifier and Type | Method and Description |
---|---|
<R> R |
Stream.collect(Supplier<R> supplier,
BiConsumer<R,? super T> accumulator,
BiConsumer<R,R> combiner)
Performs a mutable
reduction operation on the elements of this stream.
|
<R> R |
DoubleStream.collect(Supplier<R> supplier,
ObjDoubleConsumer<R> accumulator,
BiConsumer<R,R> combiner)
Performs a mutable
reduction operation on the elements of this stream.
|
<R> R |
IntStream.collect(Supplier<R> supplier,
ObjIntConsumer<R> accumulator,
BiConsumer<R,R> combiner)
Performs a mutable
reduction operation on the elements of this stream.
|
<R> R |
LongStream.collect(Supplier<R> supplier,
ObjLongConsumer<R> accumulator,
BiConsumer<R,R> combiner)
Performs a mutable
reduction operation on the elements of this stream.
|
static DoubleStream |
StreamSupport.doubleStream(Supplier<? extends Spliterator.OfDouble> supplier,
int characteristics,
boolean parallel)
Creates a new sequential or parallel
DoubleStream from a
Supplier of Spliterator.OfDouble . |
static <T> Stream<T> |
StreamSupport.generate(Supplier<? extends T> s)
Deprecated.
Use
RefStreams.generate(Supplier) instead |
static <T> Stream<T> |
RefStreams.generate(Supplier<? extends T> s)
Returns an infinite sequential unordered
Stream where each
element is generated by the provided Supplier . |
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,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 . |
static IntStream |
StreamSupport.intStream(Supplier<? extends Spliterator.OfInt> supplier,
int characteristics,
boolean parallel)
Creates a new sequential or parallel
IntStream from a
Supplier of Spliterator.OfInt . |
static LongStream |
StreamSupport.longStream(Supplier<? extends Spliterator.OfLong> supplier,
int characteristics,
boolean parallel)
Creates a new sequential or parallel
LongStream from a
Supplier of Spliterator.OfLong . |
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,R> Collector<T,R,R> |
Collectors.of(Supplier<R> supplier,
BiConsumer<R,T> accumulator,
BinaryOperator<R> combiner,
Collector.Characteristics... characteristics)
Returns a new
Collector described by the given supplier ,
accumulator , and combiner functions. |
static <T> Stream<T> |
StreamSupport.stream(Supplier<? extends Spliterator<T>> supplier,
int characteristics,
boolean parallel)
Creates a new sequential or parallel
Stream from a
Supplier of Spliterator . |
static <T,C extends Collection<T>> |
Collectors.toCollection(Supplier<C> collectionFactory)
Returns a
Collector that accumulates the input elements into a
new Collection , in encounter order. |
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> mapSupplier)
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 Map<K,U>> |
Collectors.toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction,
Supplier<M> mapSupplier)
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. |
Copyright © 2015. All rights reserved.