| Package | Description |
|---|---|
| ar.com.kfgodel.nary.api | |
| ar.com.kfgodel.nary.api.arity | |
| ar.com.kfgodel.nary.impl |
| Modifier and Type | Interface and Description |
|---|---|
interface |
Unary<T>
This type represents an unknown amount of elements but with the certainty that is either 0 or 1.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> Nary<T> |
Nary.from(Collection<T> collection)
Creates a nary instance from the elements of a collection
|
static <T> Nary<T> |
Nary.from(Enumeration<T> enumeration)
Creates a nary from an enumeration
|
static <T> Nary<T> |
Nary.from(Iterable<T> iterable)
Creates a nary from an iterable source
|
static <T> Nary<T> |
Nary.from(Iterator<T> iterator)
Creates a nary from an iterator.
|
static <K,V> Nary<Map.Entry<K,V>> |
Nary.from(Map<K,V> map)
Creates a nary from the pairs of elements in a
Map |
static <T> Nary<T> |
Nary.from(Spliterator<T> spliterator)
Creates a nary from a spliterator as source for a stream
|
static <T> Nary<T> |
Nary.from(Stream<? extends T> stream)
Creates a nary from a native stream.
|
static <T> Nary<T> |
Nary.from(Supplier<T> supplier)
Creates a new Nary instance from the given supplier that will contain only 1 element.
The supplier will be called the first time the value is needed on a terminal operation |
static <T> Nary<T> |
Nary.from(T[] array)
Creates a nary from an array
|
static <T> Nary<T> |
Nary.ofNonNullable(T element,
T... additionals)
Creates a nary containing the given elements.
|
| Modifier and Type | Method and Description |
|---|---|
Nary<T> |
MultiElement.add(T... others)
Creates a new Nary with the elements of this instance and the ones passed as var arg array
|
Nary<T> |
MultiElement.concat(Optional<? extends T> other)
Creates a concatenated Nary with the elements of this instance and the one (if any) on the given
Optional |
Nary<T> |
MultiElement.concat(Stream<? extends T> other)
Creates another nary that will contain the elements of this instance and the given stream
|
Nary<T> |
NaryStream.distinct() |
Nary<T> |
NaryStream.filter(Predicate<? super T> predicate) |
<R> Nary<R> |
NaryStream.flatMap(Function<? super T,? extends Stream<? extends R>> mapper) |
<U> Nary<U> |
MultiElement.flatMapOptional(Function<? super T,Optional<U>> mapper)
Makes a normal
Stream.flatMap(Function) transformation but accepts Optional
as result for the mapper instead of Stream.This method is the semantic equivalent of Optional.flatMap(Function) but it can be applied to more
than one element. |
Nary<T> |
NaryStream.limit(long maxSize) |
<R> Nary<R> |
NaryStream.map(Function<? super T,? extends R> mapper) |
<U> Nary<U> |
MultiElement.mapFilteringNullResult(Function<? super T,? extends U> mapper)
Map each element on this instance and filter null results out.
If the result of mapping an element produces null, then it's skipped, reducing the
amount of elements contained in the returned Nary.This is semantically equivalent to Optional.map(Function) and
different from Stream.map(Function) that takes null
as valid results |
Nary<T> |
NaryStream.peek(Consumer<? super T> action) |
Nary<T> |
NaryStream.skip(long n) |
Nary<T> |
NaryStream.sorted() |
Nary<T> |
NaryStream.sorted(Comparator<? super T> comparator) |
| Modifier and Type | Class and Description |
|---|---|
class |
EmptyNary
This type represents the empty nary
Created by kfgodel on 07/03/16. |
class |
NarySupport<T>
This type defines basic behavior for narys to be implemented
|
class |
OneElementNary<T>
This type represents a nary
Created by kfgodel on 07/03/16.
|
class |
StreamBasedNary<T>
This type represents a Nary with a stream as a source of elements.
This implies the greatest level of uncertainty as we don't know if the stream is empty, contains one, or more than one elements until it's consumed. |
| Modifier and Type | Method and Description |
|---|---|
Nary<T> |
NarySupport.add(T... others) |
Nary<Object> |
EmptyNary.concat(Optional<?> other) |
Nary<T> |
NarySupport.concat(Optional<? extends T> other) |
Nary<T> |
OneElementNary.concat(Optional<? extends T> other) |
Nary<Object> |
EmptyNary.concat(Stream<?> other) |
Nary<T> |
NarySupport.concat(Stream<? extends T> other) |
Nary<T> |
NarySupport.distinct() |
Nary<T> |
NarySupport.filter(Predicate<? super T> predicate) |
<R> Nary<R> |
EmptyNary.flatMap(Function<? super Object,? extends Stream<? extends R>> mapper) |
<R> Nary<R> |
NarySupport.flatMap(Function<? super T,? extends Stream<? extends R>> mapper) |
<U> Nary<U> |
EmptyNary.flatMapOptional(Function<? super Object,Optional<U>> mapper) |
<U> Nary<U> |
NarySupport.flatMapOptional(Function<? super T,Optional<U>> mapper) |
Nary<T> |
NarySupport.limit(long maxSize) |
<R> Nary<R> |
NarySupport.map(Function<? super T,? extends R> mapper) |
<U> Nary<U> |
NarySupport.mapFilteringNullResult(Function<? super T,? extends U> mapper) |
Nary<T> |
NarySupport.peek(Consumer<? super T> action) |
protected <R> Nary<R> |
NarySupport.returningNaryDo(Stream<R> nativeStream)
Wraps the native stream in a nary to conform to nary interface
|
Nary<T> |
NarySupport.skip(long n) |
Nary<T> |
NarySupport.sorted() |
Nary<T> |
NarySupport.sorted(Comparator<? super T> comparator) |
Copyright © 2020. All rights reserved.