| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
LOGGER |
| Modifier | Constructor and Description |
|---|---|
protected |
ApexStreamHelper() |
| Modifier and Type | Method and Description |
|---|---|
static <T> long |
consumeByPartition(Stream<T> stream,
Consumer<Queue<T>> consumer,
int partitionSize)
Enable consuming a stream by blocks of size controlled by the Queue
|
static <T> long |
consumeByPartition(Supplier<? extends BlockingQueue<T>> queueSupplier,
Stream<T> stream,
Consumer<Queue<T>> consumer)
Deprecated.
as one may provide a queueSupplier with queues without no bounded capacity
|
static <T> com.google.common.base.Predicate<T> |
distinctByKey(Function<? super T,?> keyExtractor)
persons.stream().filter(distinctByKey(p -> p.getName());
|
static <T> Stream<T> |
emptyStream()
Deprecated.
|
static <T> IntStream |
indexesOf(List<T> list,
com.google.common.base.Predicate<T> predicate) |
static <T> OptionalInt |
indexOf(List<T> list,
com.google.common.base.Predicate<T> predicate)
Justfor the sake of the example
|
static <T> Stream<T> |
singleton(T item) |
static <T,K,U,M extends Map<K,U>> |
toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
Supplier<M> mapSupplier)
http://stackoverflow.com/questions/31004899/java-8-collectors-tomap-sortedmap
|
static <T> Stream<T> |
toStream(Iterable<T> iterable)
Deprecated.
|
static <T> Stream<T> |
toStream(Iterator<T> iterator)
Deprecated.
|
@Deprecated public static <T> Stream<T> toStream(Iterator<T> iterator)
@Deprecated public static <T> Stream<T> toStream(Iterable<T> iterable)
iterable - public static <T> Stream<T> singleton(T item)
@Beta public static <T> OptionalInt indexOf(List<T> list, com.google.common.base.Predicate<T> predicate)
list - predicate - @Beta public static <T> IntStream indexesOf(List<T> list, com.google.common.base.Predicate<T> predicate)
@Beta public static <T> long consumeByPartition(Stream<T> stream, Consumer<Queue<T>> consumer, int partitionSize)
queueSupplier - we may need multiple queues if the stream is parallelstream - the stream to processconsumer - the operation to apply on each partition, which size is controlled by the capacity of the queue@Beta @Deprecated public static <T> long consumeByPartition(Supplier<? extends BlockingQueue<T>> queueSupplier, Stream<T> stream, Consumer<Queue<T>> consumer)
@Deprecated public static <T> Stream<T> emptyStream()
public static <T,K,U,M extends Map<K,U>> Collector<T,?,M> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper, Supplier<M> mapSupplier)
keyMapper - valueMapper - mapSupplier - public static <T> com.google.common.base.Predicate<T> distinctByKey(Function<? super T,?> keyExtractor)
keyExtractor - Copyright © 2014–2017 Pivotal Software, Inc.. All rights reserved.