public final class API
extends java.lang.Object
import static io.vavr.API.*;
The For
-comprehension is syntactic sugar for nested for-loops. We write
// lazily evaluated
Iterator<R> result = For(iterable1, iterable2, ..., iterableN).yield(f);
or
Iterator<R> result =
For(iterable1, v1 ->
For(iterable2, v2 ->
...
For(iterableN).yield(vN -> f.apply(v1, v2, ..., vN))
)
);
instead of
for(T1 v1 : iterable1) {
for (T2 v2 : iterable2) {
...
for (TN vN : iterableN) {
R result = f.apply(v1, v2, ..., VN);
//
// We are forced to perform side effects to do s.th. meaningful with the result.
//
}
}
}
Please note that values like Option, Try, Future, etc. are also iterable.
Given a suitable function
f: (v1, v2, ..., vN) -> ...
and 1 <= N <= 8 iterables, the result is a Stream of the
mapped cross product elements.
{ f(v1, v2, ..., vN) | v1 ∈ iterable1, ... vN ∈ iterableN }
As with all Vavr Values, the result of a For-comprehension can be converted
to standard Java library and Vavr types.Modifier and Type | Class and Description |
---|---|
static class |
API.For1<T1>
For-comprehension with one Iterable.
|
static class |
API.For2<T1,T2>
For-comprehension with two Iterables.
|
static class |
API.For3<T1,T2,T3>
For-comprehension with three Iterables.
|
static class |
API.For4<T1,T2,T3,T4>
For-comprehension with 4 Iterables.
|
static class |
API.For5<T1,T2,T3,T4,T5>
For-comprehension with 5 Iterables.
|
static class |
API.For6<T1,T2,T3,T4,T5,T6>
For-comprehension with 6 Iterables.
|
static class |
API.For7<T1,T2,T3,T4,T5,T6,T7>
For-comprehension with 7 Iterables.
|
static class |
API.For8<T1,T2,T3,T4,T5,T6,T7,T8>
For-comprehension with 8 Iterables.
|
static class |
API.Match<T>
Scala-like structural pattern matching for Java.
|
Modifier and Type | Method and Description |
---|---|
static <T> API.Match.Pattern0<T> |
$()
Wildcard pattern, matches any value.
|
static <T> API.Match.Pattern0<T> |
$(java.util.function.Predicate<? super T> predicate)
Guard pattern, checks if a predicate is satisfied.
|
static <T> API.Match.Pattern0<T> |
$(T prototype)
Value pattern, checks for equality.
|
static <T> Array<T> |
Array()
Alias for
Array.empty() |
static <T> Array<T> |
Array(T... elements)
Alias for
Array.of(Object...) |
static <T> Array<T> |
Array(T element)
Alias for
Array.of(Object) |
static <T,R> API.Match.Case<T,R> |
Case(API.Match.Pattern0<T> pattern,
java.util.function.Function<? super T,? extends R> f) |
static <T,R> API.Match.Case<T,R> |
Case(API.Match.Pattern0<T> pattern,
R retVal) |
static <T,R> API.Match.Case<T,R> |
Case(API.Match.Pattern0<T> pattern,
java.util.function.Supplier<? extends R> supplier) |
static <T,T1,R> API.Match.Case<T,R> |
Case(API.Match.Pattern1<T,T1> pattern,
java.util.function.Function<? super T1,? extends R> f) |
static <T,T1,R> API.Match.Case<T,R> |
Case(API.Match.Pattern1<T,T1> pattern,
R retVal) |
static <T,T1,R> API.Match.Case<T,R> |
Case(API.Match.Pattern1<T,T1> pattern,
java.util.function.Supplier<? extends R> supplier) |
static <T,T1,T2,R> |
Case(API.Match.Pattern2<T,T1,T2> pattern,
java.util.function.BiFunction<? super T1,? super T2,? extends R> f) |
static <T,T1,T2,R> |
Case(API.Match.Pattern2<T,T1,T2> pattern,
R retVal) |
static <T,T1,T2,R> |
Case(API.Match.Pattern2<T,T1,T2> pattern,
java.util.function.Supplier<? extends R> supplier) |
static <T,T1,T2,T3,R> |
Case(API.Match.Pattern3<T,T1,T2,T3> pattern,
Function3<? super T1,? super T2,? super T3,? extends R> f) |
static <T,T1,T2,T3,R> |
Case(API.Match.Pattern3<T,T1,T2,T3> pattern,
R retVal) |
static <T,T1,T2,T3,R> |
Case(API.Match.Pattern3<T,T1,T2,T3> pattern,
java.util.function.Supplier<? extends R> supplier) |
static <T,T1,T2,T3,T4,R> |
Case(API.Match.Pattern4<T,T1,T2,T3,T4> pattern,
Function4<? super T1,? super T2,? super T3,? super T4,? extends R> f) |
static <T,T1,T2,T3,T4,R> |
Case(API.Match.Pattern4<T,T1,T2,T3,T4> pattern,
R retVal) |
static <T,T1,T2,T3,T4,R> |
Case(API.Match.Pattern4<T,T1,T2,T3,T4> pattern,
java.util.function.Supplier<? extends R> supplier) |
static <T,T1,T2,T3,T4,T5,R> |
Case(API.Match.Pattern5<T,T1,T2,T3,T4,T5> pattern,
Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> f) |
static <T,T1,T2,T3,T4,T5,R> |
Case(API.Match.Pattern5<T,T1,T2,T3,T4,T5> pattern,
R retVal) |
static <T,T1,T2,T3,T4,T5,R> |
Case(API.Match.Pattern5<T,T1,T2,T3,T4,T5> pattern,
java.util.function.Supplier<? extends R> supplier) |
static <T,T1,T2,T3,T4,T5,T6,R> |
Case(API.Match.Pattern6<T,T1,T2,T3,T4,T5,T6> pattern,
Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> f) |
static <T,T1,T2,T3,T4,T5,T6,R> |
Case(API.Match.Pattern6<T,T1,T2,T3,T4,T5,T6> pattern,
R retVal) |
static <T,T1,T2,T3,T4,T5,T6,R> |
Case(API.Match.Pattern6<T,T1,T2,T3,T4,T5,T6> pattern,
java.util.function.Supplier<? extends R> supplier) |
static <T,T1,T2,T3,T4,T5,T6,T7,R> |
Case(API.Match.Pattern7<T,T1,T2,T3,T4,T5,T6,T7> pattern,
Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> f) |
static <T,T1,T2,T3,T4,T5,T6,T7,R> |
Case(API.Match.Pattern7<T,T1,T2,T3,T4,T5,T6,T7> pattern,
R retVal) |
static <T,T1,T2,T3,T4,T5,T6,T7,R> |
Case(API.Match.Pattern7<T,T1,T2,T3,T4,T5,T6,T7> pattern,
java.util.function.Supplier<? extends R> supplier) |
static <T,T1,T2,T3,T4,T5,T6,T7,T8,R> |
Case(API.Match.Pattern8<T,T1,T2,T3,T4,T5,T6,T7,T8> pattern,
Function8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> f) |
static <T,T1,T2,T3,T4,T5,T6,T7,T8,R> |
Case(API.Match.Pattern8<T,T1,T2,T3,T4,T5,T6,T7,T8> pattern,
R retVal) |
static <T,T1,T2,T3,T4,T5,T6,T7,T8,R> |
Case(API.Match.Pattern8<T,T1,T2,T3,T4,T5,T6,T7,T8> pattern,
java.util.function.Supplier<? extends R> supplier) |
static CharSeq |
CharSeq(char... characters)
Alias for
CharSeq.of(char...) |
static CharSeq |
CharSeq(char character)
Alias for
CharSeq.of(char) |
static CharSeq |
CharSeq(java.lang.CharSequence sequence)
Alias for
CharSeq.of(CharSequence) |
static <R> CheckedFunction0<R> |
CheckedFunction(CheckedFunction0<R> methodReference)
Alias for
CheckedFunction0.of(CheckedFunction0) |
static <T1,R> CheckedFunction1<T1,R> |
CheckedFunction(CheckedFunction1<T1,R> methodReference)
Alias for
CheckedFunction1.of(CheckedFunction1) |
static <T1,T2,R> CheckedFunction2<T1,T2,R> |
CheckedFunction(CheckedFunction2<T1,T2,R> methodReference)
Alias for
CheckedFunction2.of(CheckedFunction2) |
static <T1,T2,T3,R> |
CheckedFunction(CheckedFunction3<T1,T2,T3,R> methodReference)
Alias for
CheckedFunction3.of(CheckedFunction3) |
static <T1,T2,T3,T4,R> |
CheckedFunction(CheckedFunction4<T1,T2,T3,T4,R> methodReference)
Alias for
CheckedFunction4.of(CheckedFunction4) |
static <T1,T2,T3,T4,T5,R> |
CheckedFunction(CheckedFunction5<T1,T2,T3,T4,T5,R> methodReference)
Alias for
CheckedFunction5.of(CheckedFunction5) |
static <T1,T2,T3,T4,T5,T6,R> |
CheckedFunction(CheckedFunction6<T1,T2,T3,T4,T5,T6,R> methodReference)
Alias for
CheckedFunction6.of(CheckedFunction6) |
static <T1,T2,T3,T4,T5,T6,T7,R> |
CheckedFunction(CheckedFunction7<T1,T2,T3,T4,T5,T6,T7,R> methodReference)
Alias for
CheckedFunction7.of(CheckedFunction7) |
static <T1,T2,T3,T4,T5,T6,T7,T8,R> |
CheckedFunction(CheckedFunction8<T1,T2,T3,T4,T5,T6,T7,T8,R> methodReference)
Alias for
CheckedFunction8.of(CheckedFunction8) |
static <T> Try.Failure<T> |
Failure(java.lang.Throwable exception)
Alias for
Try.failure(Throwable) |
static <T,U> Iterator<U> |
For(java.lang.Iterable<T> ts,
java.util.function.Function<? super T,? extends java.lang.Iterable<U>> f)
A shortcut for
Iterator.ofAll(ts).flatMap(f) which allows us to write real for-comprehensions using
For(...).yield(...) . |
static <T1> API.For1<T1> |
For(java.lang.Iterable<T1> ts1)
Creates a
For -comprehension of one Iterable. |
static <T1,T2> API.For2<T1,T2> |
For(java.lang.Iterable<T1> ts1,
java.lang.Iterable<T2> ts2)
Creates a
For -comprehension of two Iterables. |
static <T1,T2,T3> API.For3<T1,T2,T3> |
For(java.lang.Iterable<T1> ts1,
java.lang.Iterable<T2> ts2,
java.lang.Iterable<T3> ts3)
Creates a
For -comprehension of three Iterables. |
static <T1,T2,T3,T4> |
For(java.lang.Iterable<T1> ts1,
java.lang.Iterable<T2> ts2,
java.lang.Iterable<T3> ts3,
java.lang.Iterable<T4> ts4)
Creates a
For -comprehension of 4 Iterables. |
static <T1,T2,T3,T4,T5> |
For(java.lang.Iterable<T1> ts1,
java.lang.Iterable<T2> ts2,
java.lang.Iterable<T3> ts3,
java.lang.Iterable<T4> ts4,
java.lang.Iterable<T5> ts5)
Creates a
For -comprehension of 5 Iterables. |
static <T1,T2,T3,T4,T5,T6> |
For(java.lang.Iterable<T1> ts1,
java.lang.Iterable<T2> ts2,
java.lang.Iterable<T3> ts3,
java.lang.Iterable<T4> ts4,
java.lang.Iterable<T5> ts5,
java.lang.Iterable<T6> ts6)
Creates a
For -comprehension of 6 Iterables. |
static <T1,T2,T3,T4,T5,T6,T7> |
For(java.lang.Iterable<T1> ts1,
java.lang.Iterable<T2> ts2,
java.lang.Iterable<T3> ts3,
java.lang.Iterable<T4> ts4,
java.lang.Iterable<T5> ts5,
java.lang.Iterable<T6> ts6,
java.lang.Iterable<T7> ts7)
Creates a
For -comprehension of 7 Iterables. |
static <T1,T2,T3,T4,T5,T6,T7,T8> |
For(java.lang.Iterable<T1> ts1,
java.lang.Iterable<T2> ts2,
java.lang.Iterable<T3> ts3,
java.lang.Iterable<T4> ts4,
java.lang.Iterable<T5> ts5,
java.lang.Iterable<T6> ts6,
java.lang.Iterable<T7> ts7,
java.lang.Iterable<T8> ts8)
Creates a
For -comprehension of 8 Iterables. |
static <R> Function0<R> |
Function(Function0<R> methodReference)
Alias for
Function0.of(Function0) |
static <T1,R> Function1<T1,R> |
Function(Function1<T1,R> methodReference)
Alias for
Function1.of(Function1) |
static <T1,T2,R> Function2<T1,T2,R> |
Function(Function2<T1,T2,R> methodReference)
Alias for
Function2.of(Function2) |
static <T1,T2,T3,R> |
Function(Function3<T1,T2,T3,R> methodReference)
Alias for
Function3.of(Function3) |
static <T1,T2,T3,T4,R> |
Function(Function4<T1,T2,T3,T4,R> methodReference)
Alias for
Function4.of(Function4) |
static <T1,T2,T3,T4,T5,R> |
Function(Function5<T1,T2,T3,T4,T5,R> methodReference)
Alias for
Function5.of(Function5) |
static <T1,T2,T3,T4,T5,T6,R> |
Function(Function6<T1,T2,T3,T4,T5,T6,R> methodReference)
Alias for
Function6.of(Function6) |
static <T1,T2,T3,T4,T5,T6,T7,R> |
Function(Function7<T1,T2,T3,T4,T5,T6,T7,R> methodReference)
Alias for
Function7.of(Function7) |
static <T1,T2,T3,T4,T5,T6,T7,T8,R> |
Function(Function8<T1,T2,T3,T4,T5,T6,T7,T8,R> methodReference)
Alias for
Function8.of(Function8) |
static <T> Future<T> |
Future(CheckedFunction0<? extends T> computation)
Alias for
Future.of(CheckedFunction0) |
static <T> Future<T> |
Future(java.util.concurrent.ExecutorService executorService,
CheckedFunction0<? extends T> computation)
|
static <T> Future<T> |
Future(java.util.concurrent.ExecutorService executorService,
T result)
|
static <T> Future<T> |
Future(T result)
Alias for
Future.successful(Object) |
static <T> IndexedSeq<T> |
IndexedSeq()
Alias for
Vector.empty() |
static <T> IndexedSeq<T> |
IndexedSeq(T... elements)
Alias for
Vector.of(Object...) |
static <T> IndexedSeq<T> |
IndexedSeq(T element)
Alias for
Vector.of(Object) |
static <E,T> Validation.Invalid<E,T> |
Invalid(E error)
Alias for
Validation.invalid(Object) |
static <T> Lazy<T> |
Lazy(java.util.function.Supplier<? extends T> supplier)
Alias for
Lazy.of(Supplier) |
static <L,R> Either.Left<L,R> |
Left(L left)
Alias for
Either.left(Object) |
static <K,V> Map<K,V> |
LinkedMap()
Alias for
LinkedHashMap.empty() |
static <K,V> Map<K,V> |
LinkedMap(K k1,
V v1)
Alias for
LinkedHashMap.of(Object, Object) |
static <K,V> Map<K,V> |
LinkedMap(K k1,
V v1,
K k2,
V v2)
|
static <K,V> Map<K,V> |
LinkedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3)
|
static <K,V> Map<K,V> |
LinkedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4)
|
static <K,V> Map<K,V> |
LinkedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5)
|
static <K,V> Map<K,V> |
LinkedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6)
|
static <K,V> Map<K,V> |
LinkedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7)
|
static <K,V> Map<K,V> |
LinkedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7,
K k8,
V v8)
|
static <K,V> Map<K,V> |
LinkedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7,
K k8,
V v8,
K k9,
V v9)
|
static <K,V> Map<K,V> |
LinkedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7,
K k8,
V v8,
K k9,
V v9,
K k10,
V v10)
|
static <K,V> Map<K,V> |
LinkedMap(Tuple2<? extends K,? extends V>... entries)
Alias for
LinkedHashMap.ofEntries(Tuple2...) |
static <T> Set<T> |
LinkedSet()
Alias for
LinkedHashSet.empty() |
static <T> Set<T> |
LinkedSet(T... elements)
Alias for
LinkedHashSet.of(Object...) |
static <T> Set<T> |
LinkedSet(T element)
Alias for
LinkedHashSet.of(Object) |
static <T> List<T> |
List()
Alias for
List.empty() |
static <T> List<T> |
List(T... elements)
Alias for
List.of(Object...) |
static <T> List<T> |
List(T element)
Alias for
List.of(Object) |
static <K,V> Map<K,V> |
Map()
Alias for
HashMap.empty() |
static <K,V> Map<K,V> |
Map(K k1,
V v1)
Alias for
HashMap.of(Object, Object) |
static <K,V> Map<K,V> |
Map(K k1,
V v1,
K k2,
V v2)
|
static <K,V> Map<K,V> |
Map(K k1,
V v1,
K k2,
V v2,
K k3,
V v3)
|
static <K,V> Map<K,V> |
Map(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4)
|
static <K,V> Map<K,V> |
Map(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5)
|
static <K,V> Map<K,V> |
Map(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6)
|
static <K,V> Map<K,V> |
Map(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7)
|
static <K,V> Map<K,V> |
Map(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7,
K k8,
V v8)
|
static <K,V> Map<K,V> |
Map(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7,
K k8,
V v8,
K k9,
V v9)
|
static <K,V> Map<K,V> |
Map(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7,
K k8,
V v8,
K k9,
V v9,
K k10,
V v10)
|
static <K,V> Map<K,V> |
Map(Tuple2<? extends K,? extends V>... entries)
Alias for
HashMap.ofEntries(Tuple2...) |
static <T> API.Match<T> |
Match(T value)
Entry point of the match API.
|
static <T> Option.None<T> |
None()
Alias for
Option.none() |
static <T> Option<T> |
Option(T value)
Alias for
Option.of(Object) |
static void |
print(java.lang.Object obj)
Shortcut for
System.out.print(obj) . |
static void |
printf(java.lang.String format,
java.lang.Object... args)
Shortcut for
System.out.printf(format, args) . |
static void |
println()
Shortcut for
System.out.println() . |
static void |
println(java.lang.Object obj)
Shortcut for
System.out.println(obj) . |
static <T extends java.lang.Comparable<? super T>> |
PriorityQueue()
Alias for
PriorityQueue.empty() |
static <T extends java.lang.Comparable<? super T>> |
PriorityQueue(java.util.Comparator<? super T> comparator)
Alias for
PriorityQueue.empty(Comparator) |
static <T> PriorityQueue<T> |
PriorityQueue(java.util.Comparator<? super T> comparator,
T... elements)
Alias for
PriorityQueue.of(Comparator, Object...) |
static <T> PriorityQueue<T> |
PriorityQueue(java.util.Comparator<? super T> comparator,
T element)
Alias for
PriorityQueue.of(Comparator, Object) |
static <T extends java.lang.Comparable<? super T>> |
PriorityQueue(T... elements)
Alias for
PriorityQueue.of(Comparable...) |
static <T extends java.lang.Comparable<? super T>> |
PriorityQueue(T element)
Alias for
PriorityQueue.of(Comparable) |
static <T> Queue<T> |
Queue()
Alias for
Queue.empty() |
static <T> Queue<T> |
Queue(T... elements)
Alias for
Queue.of(Object...) |
static <T> Queue<T> |
Queue(T element)
Alias for
Queue.of(Object) |
static <L,R> Either.Right<L,R> |
Right(R right)
Alias for
Either.right(Object) |
static java.lang.Void |
run(java.lang.Runnable unit)
Runs a
unit of work and returns Void . |
static <T> Seq<T> |
Seq()
Alias for
List.empty() |
static <T> Seq<T> |
Seq(T... elements)
Alias for
List.of(Object...) |
static <T> Seq<T> |
Seq(T element)
Alias for
List.of(Object) |
static <T> Set<T> |
Set()
Alias for
HashSet.empty() |
static <T> Set<T> |
Set(T... elements)
Alias for
HashSet.of(Object...) |
static <T> Set<T> |
Set(T element)
Alias for
HashSet.of(Object) |
static <T> Option.Some<T> |
Some(T value)
Alias for
Option.some(Object) |
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap()
Alias for
TreeMap.empty() |
static <K,V> SortedMap<K,V> |
SortedMap(java.util.Comparator<? super K> keyComparator)
Alias for
TreeMap.empty(Comparator) |
static <K,V> SortedMap<K,V> |
SortedMap(java.util.Comparator<? super K> keyComparator,
K key,
V value)
Alias for
TreeMap.of(Comparator, Object, Object) |
static <K,V> SortedMap<K,V> |
SortedMap(java.util.Comparator<? super K> keyComparator,
Tuple2<? extends K,? extends V>... entries)
Alias for
TreeMap.ofEntries(Comparator, Tuple2...) |
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(K k1,
V v1)
Alias for
TreeMap.of(Comparable, Object) |
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(K k1,
V v1,
K k2,
V v2)
|
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3)
|
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4)
|
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5)
|
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6)
|
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7)
|
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7,
K k8,
V v8)
|
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7,
K k8,
V v8,
K k9,
V v9)
|
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6,
K k7,
V v7,
K k8,
V v8,
K k9,
V v9,
K k10,
V v10)
|
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(java.util.Map<? extends K,? extends V> map)
Alias for
TreeMap.ofAll(java.util.Map) |
static <K extends java.lang.Comparable<? super K>,V> |
SortedMap(Tuple2<? extends K,? extends V>... entries)
Alias for
TreeMap.ofEntries(Tuple2...) |
static <T extends java.lang.Comparable<? super T>> |
SortedSet()
Alias for
TreeSet.empty() |
static <T extends java.lang.Comparable<? super T>> |
SortedSet(java.util.Comparator<? super T> comparator)
Alias for
TreeSet.empty(Comparator) |
static <T> SortedSet<T> |
SortedSet(java.util.Comparator<? super T> comparator,
T... elements)
Alias for
TreeSet.of(Comparator, Object...) |
static <T> SortedSet<T> |
SortedSet(java.util.Comparator<? super T> comparator,
T element)
Alias for
TreeSet.of(Comparator, Object) |
static <T extends java.lang.Comparable<? super T>> |
SortedSet(T... elements)
Alias for
TreeSet.of(Comparable...) |
static <T extends java.lang.Comparable<? super T>> |
SortedSet(T element)
Alias for
TreeSet.of(Comparable) |
static <T> Stream<T> |
Stream()
Alias for
Stream.empty() |
static <T> Stream<T> |
Stream(T... elements)
Alias for
Stream.of(Object...) |
static <T> Stream<T> |
Stream(T element)
Alias for
Stream.of(Object) |
static <T> Try.Success<T> |
Success(T value)
Alias for
Try.success(Object) |
static <T> T |
TODO()
A temporary replacement for an implementations used during prototyping.
|
static <T> T |
TODO(java.lang.String msg)
A temporary replacement for an implementations used during prototyping.
|
static <T> Try<T> |
Try(CheckedFunction0<? extends T> supplier)
Alias for
Try.of(CheckedFunction0) |
static Tuple0 |
Tuple()
Alias for
Tuple.empty() |
static <T1> Tuple1<T1> |
Tuple(T1 t1)
Alias for
Tuple.of(Object)
Creates a tuple of one element. |
static <T1,T2> Tuple2<T1,T2> |
Tuple(T1 t1,
T2 t2)
Alias for
Tuple.of(Object, Object)
Creates a tuple of two elements. |
static <T1,T2,T3> Tuple3<T1,T2,T3> |
Tuple(T1 t1,
T2 t2,
T3 t3)
Alias for
Tuple.of(Object, Object, Object)
Creates a tuple of three elements. |
static <T1,T2,T3,T4> |
Tuple(T1 t1,
T2 t2,
T3 t3,
T4 t4)
Alias for
Tuple.of(Object, Object, Object, Object)
Creates a tuple of 4 elements. |
static <T1,T2,T3,T4,T5> |
Tuple(T1 t1,
T2 t2,
T3 t3,
T4 t4,
T5 t5)
Alias for
Tuple.of(Object, Object, Object, Object, Object)
Creates a tuple of 5 elements. |
static <T1,T2,T3,T4,T5,T6> |
Tuple(T1 t1,
T2 t2,
T3 t3,
T4 t4,
T5 t5,
T6 t6)
Alias for
Tuple.of(Object, Object, Object, Object, Object, Object)
Creates a tuple of 6 elements. |
static <T1,T2,T3,T4,T5,T6,T7> |
Tuple(T1 t1,
T2 t2,
T3 t3,
T4 t4,
T5 t5,
T6 t6,
T7 t7)
Alias for
Tuple.of(Object, Object, Object, Object, Object, Object, Object)
Creates a tuple of 7 elements. |
static <T1,T2,T3,T4,T5,T6,T7,T8> |
Tuple(T1 t1,
T2 t2,
T3 t3,
T4 t4,
T5 t5,
T6 t6,
T7 t7,
T8 t8)
Alias for
Tuple.of(Object, Object, Object, Object, Object, Object, Object, Object)
Creates a tuple of 8 elements. |
static <R> Function0<R> |
unchecked(CheckedFunction0<R> f)
Alias for
CheckedFunction0.unchecked() |
static <T1,R> Function1<T1,R> |
unchecked(CheckedFunction1<T1,R> f)
Alias for
CheckedFunction1.unchecked() |
static <T1,T2,R> Function2<T1,T2,R> |
unchecked(CheckedFunction2<T1,T2,R> f)
Alias for
CheckedFunction2.unchecked() |
static <T1,T2,T3,R> |
unchecked(CheckedFunction3<T1,T2,T3,R> f)
Alias for
CheckedFunction3.unchecked() |
static <T1,T2,T3,T4,R> |
unchecked(CheckedFunction4<T1,T2,T3,T4,R> f)
Alias for
CheckedFunction4.unchecked() |
static <T1,T2,T3,T4,T5,R> |
unchecked(CheckedFunction5<T1,T2,T3,T4,T5,R> f)
Alias for
CheckedFunction5.unchecked() |
static <T1,T2,T3,T4,T5,T6,R> |
unchecked(CheckedFunction6<T1,T2,T3,T4,T5,T6,R> f)
Alias for
CheckedFunction6.unchecked() |
static <T1,T2,T3,T4,T5,T6,T7,R> |
unchecked(CheckedFunction7<T1,T2,T3,T4,T5,T6,T7,R> f)
Alias for
CheckedFunction7.unchecked() |
static <T1,T2,T3,T4,T5,T6,T7,T8,R> |
unchecked(CheckedFunction8<T1,T2,T3,T4,T5,T6,T7,T8,R> f)
Alias for
CheckedFunction8.unchecked() |
static <E,T> Validation.Valid<E,T> |
Valid(T value)
Alias for
Validation.valid(Object) |
static <T> Vector<T> |
Vector()
Alias for
Vector.empty() |
static <T> Vector<T> |
Vector(T... elements)
Alias for
Vector.of(Object...) |
static <T> Vector<T> |
Vector(T element)
Alias for
Vector.of(Object) |
public static <T> T TODO()
Example:
public HttpResponse getResponse(HttpRequest request) {
return TODO();
}
final HttpResponse response = getHttpResponse(TODO());
T
- The result type of the missing implementation.NotImplementedError
- when this methods is calledNotImplementedError.NotImplementedError()
public static <T> T TODO(java.lang.String msg)
Example:
public HttpResponse getResponse(HttpRequest request) {
return TODO("fake response");
}
final HttpResponse response = getHttpResponse(TODO("fake request"));
T
- The result type of the missing implementation.msg
- An error messageNotImplementedError
- when this methods is calledNotImplementedError.NotImplementedError(String)
public static void print(java.lang.Object obj)
System.out.print(obj)
. See PrintStream.print(Object)
.obj
- The Object
to be printed@GwtIncompatible public static void printf(java.lang.String format, java.lang.Object... args)
System.out.printf(format, args)
. See PrintStream.printf(String, Object...)
.format
- A format string as described in Formatter
.args
- Arguments referenced by the format specifierspublic static void println(java.lang.Object obj)
System.out.println(obj)
. See PrintStream.println(Object)
.obj
- The Object
to be printedpublic static void println()
System.out.println()
. See PrintStream.println()
.public static <R> Function0<R> Function(Function0<R> methodReference)
Function0.of(Function0)
R
- return typemethodReference
- A method referenceFunction0
public static <T1,R> Function1<T1,R> Function(Function1<T1,R> methodReference)
Function1.of(Function1)
R
- return typeT1
- type of the 1st argumentmethodReference
- A method referenceFunction1
public static <T1,T2,R> Function2<T1,T2,R> Function(Function2<T1,T2,R> methodReference)
Function2.of(Function2)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentmethodReference
- A method referenceFunction2
public static <T1,T2,T3,R> Function3<T1,T2,T3,R> Function(Function3<T1,T2,T3,R> methodReference)
Function3.of(Function3)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentmethodReference
- A method referenceFunction3
public static <T1,T2,T3,T4,R> Function4<T1,T2,T3,T4,R> Function(Function4<T1,T2,T3,T4,R> methodReference)
Function4.of(Function4)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentmethodReference
- A method referenceFunction4
public static <T1,T2,T3,T4,T5,R> Function5<T1,T2,T3,T4,T5,R> Function(Function5<T1,T2,T3,T4,T5,R> methodReference)
Function5.of(Function5)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentmethodReference
- A method referenceFunction5
public static <T1,T2,T3,T4,T5,T6,R> Function6<T1,T2,T3,T4,T5,T6,R> Function(Function6<T1,T2,T3,T4,T5,T6,R> methodReference)
Function6.of(Function6)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentT6
- type of the 6th argumentmethodReference
- A method referenceFunction6
public static <T1,T2,T3,T4,T5,T6,T7,R> Function7<T1,T2,T3,T4,T5,T6,T7,R> Function(Function7<T1,T2,T3,T4,T5,T6,T7,R> methodReference)
Function7.of(Function7)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentT6
- type of the 6th argumentT7
- type of the 7th argumentmethodReference
- A method referenceFunction7
public static <T1,T2,T3,T4,T5,T6,T7,T8,R> Function8<T1,T2,T3,T4,T5,T6,T7,T8,R> Function(Function8<T1,T2,T3,T4,T5,T6,T7,T8,R> methodReference)
Function8.of(Function8)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentT6
- type of the 6th argumentT7
- type of the 7th argumentT8
- type of the 8th argumentmethodReference
- A method referenceFunction8
public static <R> CheckedFunction0<R> CheckedFunction(CheckedFunction0<R> methodReference)
CheckedFunction0.of(CheckedFunction0)
R
- return typemethodReference
- A method referenceCheckedFunction0
public static <T1,R> CheckedFunction1<T1,R> CheckedFunction(CheckedFunction1<T1,R> methodReference)
CheckedFunction1.of(CheckedFunction1)
R
- return typeT1
- type of the 1st argumentmethodReference
- A method referenceCheckedFunction1
public static <T1,T2,R> CheckedFunction2<T1,T2,R> CheckedFunction(CheckedFunction2<T1,T2,R> methodReference)
CheckedFunction2.of(CheckedFunction2)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentmethodReference
- A method referenceCheckedFunction2
public static <T1,T2,T3,R> CheckedFunction3<T1,T2,T3,R> CheckedFunction(CheckedFunction3<T1,T2,T3,R> methodReference)
CheckedFunction3.of(CheckedFunction3)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentmethodReference
- A method referenceCheckedFunction3
public static <T1,T2,T3,T4,R> CheckedFunction4<T1,T2,T3,T4,R> CheckedFunction(CheckedFunction4<T1,T2,T3,T4,R> methodReference)
CheckedFunction4.of(CheckedFunction4)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentmethodReference
- A method referenceCheckedFunction4
public static <T1,T2,T3,T4,T5,R> CheckedFunction5<T1,T2,T3,T4,T5,R> CheckedFunction(CheckedFunction5<T1,T2,T3,T4,T5,R> methodReference)
CheckedFunction5.of(CheckedFunction5)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentmethodReference
- A method referenceCheckedFunction5
public static <T1,T2,T3,T4,T5,T6,R> CheckedFunction6<T1,T2,T3,T4,T5,T6,R> CheckedFunction(CheckedFunction6<T1,T2,T3,T4,T5,T6,R> methodReference)
CheckedFunction6.of(CheckedFunction6)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentT6
- type of the 6th argumentmethodReference
- A method referenceCheckedFunction6
public static <T1,T2,T3,T4,T5,T6,T7,R> CheckedFunction7<T1,T2,T3,T4,T5,T6,T7,R> CheckedFunction(CheckedFunction7<T1,T2,T3,T4,T5,T6,T7,R> methodReference)
CheckedFunction7.of(CheckedFunction7)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentT6
- type of the 6th argumentT7
- type of the 7th argumentmethodReference
- A method referenceCheckedFunction7
public static <T1,T2,T3,T4,T5,T6,T7,T8,R> CheckedFunction8<T1,T2,T3,T4,T5,T6,T7,T8,R> CheckedFunction(CheckedFunction8<T1,T2,T3,T4,T5,T6,T7,T8,R> methodReference)
CheckedFunction8.of(CheckedFunction8)
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentT6
- type of the 6th argumentT7
- type of the 7th argumentT8
- type of the 8th argumentmethodReference
- A method referenceCheckedFunction8
public static <R> Function0<R> unchecked(CheckedFunction0<R> f)
CheckedFunction0.unchecked()
R
- return typef
- A method referenceCheckedFunction0
public static <T1,R> Function1<T1,R> unchecked(CheckedFunction1<T1,R> f)
CheckedFunction1.unchecked()
R
- return typeT1
- type of the 1st argumentf
- A method referenceCheckedFunction1
public static <T1,T2,R> Function2<T1,T2,R> unchecked(CheckedFunction2<T1,T2,R> f)
CheckedFunction2.unchecked()
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentf
- A method referenceCheckedFunction2
public static <T1,T2,T3,R> Function3<T1,T2,T3,R> unchecked(CheckedFunction3<T1,T2,T3,R> f)
CheckedFunction3.unchecked()
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentf
- A method referenceCheckedFunction3
public static <T1,T2,T3,T4,R> Function4<T1,T2,T3,T4,R> unchecked(CheckedFunction4<T1,T2,T3,T4,R> f)
CheckedFunction4.unchecked()
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentf
- A method referenceCheckedFunction4
public static <T1,T2,T3,T4,T5,R> Function5<T1,T2,T3,T4,T5,R> unchecked(CheckedFunction5<T1,T2,T3,T4,T5,R> f)
CheckedFunction5.unchecked()
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentf
- A method referenceCheckedFunction5
public static <T1,T2,T3,T4,T5,T6,R> Function6<T1,T2,T3,T4,T5,T6,R> unchecked(CheckedFunction6<T1,T2,T3,T4,T5,T6,R> f)
CheckedFunction6.unchecked()
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentT6
- type of the 6th argumentf
- A method referenceCheckedFunction6
public static <T1,T2,T3,T4,T5,T6,T7,R> Function7<T1,T2,T3,T4,T5,T6,T7,R> unchecked(CheckedFunction7<T1,T2,T3,T4,T5,T6,T7,R> f)
CheckedFunction7.unchecked()
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentT6
- type of the 6th argumentT7
- type of the 7th argumentf
- A method referenceCheckedFunction7
public static <T1,T2,T3,T4,T5,T6,T7,T8,R> Function8<T1,T2,T3,T4,T5,T6,T7,T8,R> unchecked(CheckedFunction8<T1,T2,T3,T4,T5,T6,T7,T8,R> f)
CheckedFunction8.unchecked()
R
- return typeT1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentT6
- type of the 6th argumentT7
- type of the 7th argumentT8
- type of the 8th argumentf
- A method referenceCheckedFunction8
public static Tuple0 Tuple()
Tuple.empty()
public static <T1> Tuple1<T1> Tuple(T1 t1)
Tuple.of(Object)
Creates a tuple of one element.T1
- type of the 1st elementt1
- the 1st elementpublic static <T1,T2> Tuple2<T1,T2> Tuple(T1 t1, T2 t2)
Tuple.of(Object, Object)
Creates a tuple of two elements.T1
- type of the 1st elementT2
- type of the 2nd elementt1
- the 1st elementt2
- the 2nd elementpublic static <T1,T2,T3> Tuple3<T1,T2,T3> Tuple(T1 t1, T2 t2, T3 t3)
Tuple.of(Object, Object, Object)
Creates a tuple of three elements.T1
- type of the 1st elementT2
- type of the 2nd elementT3
- type of the 3rd elementt1
- the 1st elementt2
- the 2nd elementt3
- the 3rd elementpublic static <T1,T2,T3,T4> Tuple4<T1,T2,T3,T4> Tuple(T1 t1, T2 t2, T3 t3, T4 t4)
Tuple.of(Object, Object, Object, Object)
Creates a tuple of 4 elements.T1
- type of the 1st elementT2
- type of the 2nd elementT3
- type of the 3rd elementT4
- type of the 4th elementt1
- the 1st elementt2
- the 2nd elementt3
- the 3rd elementt4
- the 4th elementpublic static <T1,T2,T3,T4,T5> Tuple5<T1,T2,T3,T4,T5> Tuple(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
Tuple.of(Object, Object, Object, Object, Object)
Creates a tuple of 5 elements.T1
- type of the 1st elementT2
- type of the 2nd elementT3
- type of the 3rd elementT4
- type of the 4th elementT5
- type of the 5th elementt1
- the 1st elementt2
- the 2nd elementt3
- the 3rd elementt4
- the 4th elementt5
- the 5th elementpublic static <T1,T2,T3,T4,T5,T6> Tuple6<T1,T2,T3,T4,T5,T6> Tuple(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
Tuple.of(Object, Object, Object, Object, Object, Object)
Creates a tuple of 6 elements.T1
- type of the 1st elementT2
- type of the 2nd elementT3
- type of the 3rd elementT4
- type of the 4th elementT5
- type of the 5th elementT6
- type of the 6th elementt1
- the 1st elementt2
- the 2nd elementt3
- the 3rd elementt4
- the 4th elementt5
- the 5th elementt6
- the 6th elementpublic static <T1,T2,T3,T4,T5,T6,T7> Tuple7<T1,T2,T3,T4,T5,T6,T7> Tuple(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
Tuple.of(Object, Object, Object, Object, Object, Object, Object)
Creates a tuple of 7 elements.T1
- type of the 1st elementT2
- type of the 2nd elementT3
- type of the 3rd elementT4
- type of the 4th elementT5
- type of the 5th elementT6
- type of the 6th elementT7
- type of the 7th elementt1
- the 1st elementt2
- the 2nd elementt3
- the 3rd elementt4
- the 4th elementt5
- the 5th elementt6
- the 6th elementt7
- the 7th elementpublic static <T1,T2,T3,T4,T5,T6,T7,T8> Tuple8<T1,T2,T3,T4,T5,T6,T7,T8> Tuple(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
Tuple.of(Object, Object, Object, Object, Object, Object, Object, Object)
Creates a tuple of 8 elements.T1
- type of the 1st elementT2
- type of the 2nd elementT3
- type of the 3rd elementT4
- type of the 4th elementT5
- type of the 5th elementT6
- type of the 6th elementT7
- type of the 7th elementT8
- type of the 8th elementt1
- the 1st elementt2
- the 2nd elementt3
- the 3rd elementt4
- the 4th elementt5
- the 5th elementt6
- the 6th elementt7
- the 7th elementt8
- the 8th elementpublic static <L,R> Either.Right<L,R> Right(R right)
Either.right(Object)
L
- Type of left value.R
- Type of right value.right
- The value.Either.Right
instance.public static <L,R> Either.Left<L,R> Left(L left)
Either.left(Object)
L
- Type of left value.R
- Type of right value.left
- The value.Either.Left
instance.public static <T> Future<T> Future(CheckedFunction0<? extends T> computation)
Future.of(CheckedFunction0)
T
- Type of the computation result.computation
- A computation.Future
instance.java.lang.NullPointerException
- if computation is null.public static <T> Future<T> Future(java.util.concurrent.ExecutorService executorService, CheckedFunction0<? extends T> computation)
T
- Type of the computation result.executorService
- An executor service.computation
- A computation.Future
instance.java.lang.NullPointerException
- if one of executorService or computation is null.public static <T> Future<T> Future(T result)
Future.successful(Object)
T
- The value type of a successful result.result
- The result.Future
.public static <T> Future<T> Future(java.util.concurrent.ExecutorService executorService, T result)
T
- The value type of a successful result.executorService
- An ExecutorService
.result
- The result.Future
.java.lang.NullPointerException
- if executorService is nullpublic static <T> Lazy<T> Lazy(java.util.function.Supplier<? extends T> supplier)
Lazy.of(Supplier)
T
- type of the lazy valuesupplier
- A supplierLazy
public static <T> Option<T> Option(T value)
Option.of(Object)
T
- type of the valuevalue
- A valueOption.Some
if value is not null
, Option.None
otherwisepublic static <T> Option.Some<T> Some(T value)
Option.some(Object)
T
- type of the valuevalue
- A valueOption.Some
public static <T> Option.None<T> None()
Option.none()
T
- component typeOption.None
public static <T> Try<T> Try(CheckedFunction0<? extends T> supplier)
Try.of(CheckedFunction0)
T
- Component typesupplier
- A checked supplierTry.Success
if no exception occurs, otherwise Try.Failure
if an
exception occurs calling supplier.get()
.public static <T> Try.Success<T> Success(T value)
Try.success(Object)
T
- Type of the given value
.value
- A value.Try.Success
.public static <T> Try.Failure<T> Failure(java.lang.Throwable exception)
Try.failure(Throwable)
T
- Component type of the Try
.exception
- An exception.Try.Failure
.public static <E,T> Validation.Valid<E,T> Valid(T value)
Validation.valid(Object)
E
- type of the errorT
- type of the given value
value
- A valueValidation.Valid
java.lang.NullPointerException
- if value is nullpublic static <E,T> Validation.Invalid<E,T> Invalid(E error)
Validation.invalid(Object)
E
- type of the given error
T
- type of the valueerror
- An errorValidation.Invalid
java.lang.NullPointerException
- if error is nullpublic static CharSeq CharSeq(char character)
CharSeq.of(char)
character
- A character.CharSeq
instance containing the given elementpublic static CharSeq CharSeq(char... characters)
CharSeq.of(char...)
characters
- Zero or more characters.CharSeq
instance containing the given characters in the same order.java.lang.NullPointerException
- if elements
is nullpublic static CharSeq CharSeq(java.lang.CharSequence sequence)
CharSeq.of(CharSequence)
sequence
- CharSequence
instance.CharSeq
instancepublic static <T extends java.lang.Comparable<? super T>> PriorityQueue<T> PriorityQueue()
PriorityQueue.empty()
T
- Component type of element.PriorityQueue
empty instancepublic static <T extends java.lang.Comparable<? super T>> PriorityQueue<T> PriorityQueue(java.util.Comparator<? super T> comparator)
PriorityQueue.empty(Comparator)
T
- Component type of element.comparator
- The comparator used to sort the elementsPriorityQueue
empty instancepublic static <T extends java.lang.Comparable<? super T>> PriorityQueue<T> PriorityQueue(T element)
PriorityQueue.of(Comparable)
T
- Component type of element.element
- An element.PriorityQueue
instance containing the given elementpublic static <T> PriorityQueue<T> PriorityQueue(java.util.Comparator<? super T> comparator, T element)
PriorityQueue.of(Comparator, Object)
T
- Component type of element.comparator
- The comparator used to sort the elementselement
- An element.PriorityQueue
instance containing the given element@SafeVarargs public static <T extends java.lang.Comparable<? super T>> PriorityQueue<T> PriorityQueue(T... elements)
PriorityQueue.of(Comparable...)
T
- Component type of element.elements
- Zero or more elements.PriorityQueue
instance containing the given elements@SafeVarargs public static <T> PriorityQueue<T> PriorityQueue(java.util.Comparator<? super T> comparator, T... elements)
PriorityQueue.of(Comparator, Object...)
T
- Component type of element.comparator
- The comparator used to sort the elementselements
- Zero or more elements.PriorityQueue
instance containing the given elementspublic static <T> Seq<T> Seq()
List.empty()
T
- Component type of element.List
public static <T> Seq<T> Seq(T element)
List.of(Object)
T
- Component type of element.element
- An element.List
instance containing the given element@SafeVarargs public static <T> Seq<T> Seq(T... elements)
List.of(Object...)
T
- Component type of elements.elements
- Zero or more elements.List
instance containing the given elementsjava.lang.NullPointerException
- if elements
is nullpublic static <T> IndexedSeq<T> IndexedSeq()
Vector.empty()
T
- Component type of element.Vector
public static <T> IndexedSeq<T> IndexedSeq(T element)
Vector.of(Object)
T
- Component type of element.element
- An element.Vector
instance containing the given element@SafeVarargs public static <T> IndexedSeq<T> IndexedSeq(T... elements)
Vector.of(Object...)
T
- Component type of elements.elements
- Zero or more elements.Vector
instance containing the given elementsjava.lang.NullPointerException
- if elements
is nullpublic static <T> Array<T> Array()
Array.empty()
T
- Component type of element.Array
public static <T> Array<T> Array(T element)
Array.of(Object)
T
- Component type of element.element
- An element.Array
instance containing the given element@SafeVarargs public static <T> Array<T> Array(T... elements)
Array.of(Object...)
T
- Component type of elements.elements
- Zero or more elements.Array
instance containing the given elementsjava.lang.NullPointerException
- if elements
is nullpublic static <T> List<T> List()
List.empty()
T
- Component type of element.List
public static <T> List<T> List(T element)
List.of(Object)
T
- Component type of element.element
- An element.List
instance containing the given element@SafeVarargs public static <T> List<T> List(T... elements)
List.of(Object...)
T
- Component type of elements.elements
- Zero or more elements.List
instance containing the given elementsjava.lang.NullPointerException
- if elements
is nullpublic static <T> Queue<T> Queue()
Queue.empty()
T
- Component type of element.Queue
public static <T> Queue<T> Queue(T element)
Queue.of(Object)
T
- Component type of element.element
- An element.Queue
instance containing the given element@SafeVarargs public static <T> Queue<T> Queue(T... elements)
Queue.of(Object...)
T
- Component type of elements.elements
- Zero or more elements.Queue
instance containing the given elementsjava.lang.NullPointerException
- if elements
is nullpublic static <T> Stream<T> Stream()
Stream.empty()
T
- Component type of element.Stream
public static <T> Stream<T> Stream(T element)
Stream.of(Object)
T
- Component type of element.element
- An element.Stream
instance containing the given element@SafeVarargs public static <T> Stream<T> Stream(T... elements)
Stream.of(Object...)
T
- Component type of elements.elements
- Zero or more elements.Stream
instance containing the given elementsjava.lang.NullPointerException
- if elements
is nullpublic static <T> Vector<T> Vector()
Vector.empty()
T
- Component type of element.Vector
public static <T> Vector<T> Vector(T element)
Vector.of(Object)
T
- Component type of element.element
- An element.Vector
instance containing the given element@SafeVarargs public static <T> Vector<T> Vector(T... elements)
Vector.of(Object...)
T
- Component type of elements.elements
- Zero or more elements.Vector
instance containing the given elementsjava.lang.NullPointerException
- if elements
is nullpublic static <T> Set<T> Set()
HashSet.empty()
T
- Component type of element.HashSet
public static <T> Set<T> Set(T element)
HashSet.of(Object)
T
- Component type of element.element
- An element.HashSet
instance containing the given element@SafeVarargs public static <T> Set<T> Set(T... elements)
HashSet.of(Object...)
T
- Component type of elements.elements
- Zero or more elements.HashSet
instance containing the given elementsjava.lang.NullPointerException
- if elements
is nullpublic static <T> Set<T> LinkedSet()
LinkedHashSet.empty()
T
- Component type of element.LinkedHashSet
public static <T> Set<T> LinkedSet(T element)
LinkedHashSet.of(Object)
T
- Component type of element.element
- An element.LinkedHashSet
instance containing the given element@SafeVarargs public static <T> Set<T> LinkedSet(T... elements)
LinkedHashSet.of(Object...)
T
- Component type of elements.elements
- Zero or more elements.LinkedHashSet
instance containing the given elementsjava.lang.NullPointerException
- if elements
is nullpublic static <T extends java.lang.Comparable<? super T>> SortedSet<T> SortedSet()
TreeSet.empty()
T
- Component type of element.TreeSet
empty instancepublic static <T extends java.lang.Comparable<? super T>> SortedSet<T> SortedSet(java.util.Comparator<? super T> comparator)
TreeSet.empty(Comparator)
T
- Component type of element.comparator
- The comparator used to sort the elementsTreeSet
empty instancepublic static <T extends java.lang.Comparable<? super T>> SortedSet<T> SortedSet(T element)
TreeSet.of(Comparable)
T
- Component type of element.element
- An element.TreeSet
instance containing the given elementpublic static <T> SortedSet<T> SortedSet(java.util.Comparator<? super T> comparator, T element)
TreeSet.of(Comparator, Object)
T
- Component type of element.comparator
- The comparator used to sort the elementselement
- An element.TreeSet
instance containing the given element@SafeVarargs public static <T extends java.lang.Comparable<? super T>> SortedSet<T> SortedSet(T... elements)
TreeSet.of(Comparable...)
T
- Component type of element.elements
- Zero or more elements.TreeSet
instance containing the given elements@SafeVarargs public static <T> SortedSet<T> SortedSet(java.util.Comparator<? super T> comparator, T... elements)
TreeSet.of(Comparator, Object...)
T
- Component type of element.comparator
- The comparator used to sort the elementselements
- Zero or more elements.TreeSet
instance containing the given elementspublic static <K,V> Map<K,V> Map()
HashMap.empty()
K
- The key type.V
- The value type.HashMap
@SafeVarargs public static <K,V> Map<K,V> Map(Tuple2<? extends K,? extends V>... entries)
HashMap.ofEntries(Tuple2...)
K
- The key type.V
- The value type.entries
- Map entries.HashMap
instance containing the given entriespublic static <K,V> Map<K,V> Map(K k1, V v1)
HashMap.of(Object, Object)
K
- The key type.V
- The value type.k1
- The keyv1
- The valueHashMap
instance containing the given entriespublic static <K,V> Map<K,V> Map(K k1, V v1, K k2, V v2)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairHashMap
instance containing the given entriespublic static <K,V> Map<K,V> Map(K k1, V v1, K k2, V v2, K k3, V v3)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairHashMap
instance containing the given entriespublic static <K,V> Map<K,V> Map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairHashMap
instance containing the given entriespublic static <K,V> Map<K,V> Map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
HashMap.of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairHashMap
instance containing the given entriespublic static <K,V> Map<K,V> Map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairHashMap
instance containing the given entriespublic static <K,V> Map<K,V> Map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairHashMap
instance containing the given entriespublic static <K,V> Map<K,V> Map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairk8
- The key of the 8th pairv8
- The value of the 8th pairHashMap
instance containing the given entriespublic static <K,V> Map<K,V> Map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairk8
- The key of the 8th pairv8
- The value of the 8th pairk9
- The key of the 9th pairv9
- The value of the 9th pairHashMap
instance containing the given entriespublic static <K,V> Map<K,V> Map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairk8
- The key of the 8th pairv8
- The value of the 8th pairk9
- The key of the 9th pairv9
- The value of the 9th pairk10
- The key of the 10th pairv10
- The value of the 10th pairHashMap
instance containing the given entriespublic static <K,V> Map<K,V> LinkedMap()
LinkedHashMap.empty()
K
- The key type.V
- The value type.LinkedHashMap
@SafeVarargs public static <K,V> Map<K,V> LinkedMap(Tuple2<? extends K,? extends V>... entries)
LinkedHashMap.ofEntries(Tuple2...)
K
- The key type.V
- The value type.entries
- Map entries.LinkedHashMap
instance containing the given entriespublic static <K,V> Map<K,V> LinkedMap(K k1, V v1)
LinkedHashMap.of(Object, Object)
K
- The key type.V
- The value type.k1
- The keyv1
- The valueLinkedHashMap
instance containing the given entriespublic static <K,V> Map<K,V> LinkedMap(K k1, V v1, K k2, V v2)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairLinkedHashMap
instance containing the given entriespublic static <K,V> Map<K,V> LinkedMap(K k1, V v1, K k2, V v2, K k3, V v3)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairLinkedHashMap
instance containing the given entriespublic static <K,V> Map<K,V> LinkedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairLinkedHashMap
instance containing the given entriespublic static <K,V> Map<K,V> LinkedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
LinkedHashMap.of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairLinkedHashMap
instance containing the given entriespublic static <K,V> Map<K,V> LinkedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairLinkedHashMap
instance containing the given entriespublic static <K,V> Map<K,V> LinkedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairLinkedHashMap
instance containing the given entriespublic static <K,V> Map<K,V> LinkedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairk8
- The key of the 8th pairv8
- The value of the 8th pairLinkedHashMap
instance containing the given entriespublic static <K,V> Map<K,V> LinkedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairk8
- The key of the 8th pairv8
- The value of the 8th pairk9
- The key of the 9th pairv9
- The value of the 9th pairLinkedHashMap
instance containing the given entriespublic static <K,V> Map<K,V> LinkedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairk8
- The key of the 8th pairv8
- The value of the 8th pairk9
- The key of the 9th pairv9
- The value of the 9th pairk10
- The key of the 10th pairv10
- The value of the 10th pairLinkedHashMap
instance containing the given entriespublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap()
TreeMap.empty()
K
- The key type.V
- The value type.TreeMap
instancepublic static <K,V> SortedMap<K,V> SortedMap(java.util.Comparator<? super K> keyComparator)
TreeMap.empty(Comparator)
K
- The key type.V
- The value type.keyComparator
- The comparator used to sort the entries by their keyTreeMap
instancepublic static <K,V> SortedMap<K,V> SortedMap(java.util.Comparator<? super K> keyComparator, K key, V value)
TreeMap.of(Comparator, Object, Object)
K
- The key type.V
- The value type.keyComparator
- The comparator used to sort the entries by their keykey
- A singleton map key.value
- A singleton map value.TreeMap
instance containing the given entry@SafeVarargs public static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(Tuple2<? extends K,? extends V>... entries)
TreeMap.ofEntries(Tuple2...)
K
- The key type.V
- The value type.entries
- Map entries.TreeMap
instance containing the given entries@SafeVarargs public static <K,V> SortedMap<K,V> SortedMap(java.util.Comparator<? super K> keyComparator, Tuple2<? extends K,? extends V>... entries)
TreeMap.ofEntries(Comparator, Tuple2...)
K
- The key type.V
- The value type.keyComparator
- The comparator used to sort the entries by their keyentries
- Map entries.TreeMap
instance containing the given entrypublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(java.util.Map<? extends K,? extends V> map)
TreeMap.ofAll(java.util.Map)
K
- The key type.V
- The value type.map
- A map entry.TreeMap
instance containing the given mappublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1)
TreeMap.of(Comparable, Object)
K
- The key type.V
- The value type.k1
- The keyv1
- The valueTreeMap
instance containing the given entriespublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1, K k2, V v2)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairTreeMap
instance containing the given entriespublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1, K k2, V v2, K k3, V v3)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairTreeMap
instance containing the given entriespublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
TreeMap.of(Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairTreeMap
instance containing the given entriespublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairTreeMap
instance containing the given entriespublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairTreeMap
instance containing the given entriespublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairTreeMap
instance containing the given entriespublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairk8
- The key of the 8th pairv8
- The value of the 8th pairTreeMap
instance containing the given entriespublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairk8
- The key of the 8th pairv8
- The value of the 8th pairk9
- The key of the 9th pairv9
- The value of the 9th pairTreeMap
instance containing the given entriespublic static <K extends java.lang.Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10)
K
- The key type.V
- The value type.k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pairk3
- The key of the 3rd pairv3
- The value of the 3rd pairk4
- The key of the 4th pairv4
- The value of the 4th pairk5
- The key of the 5th pairv5
- The value of the 5th pairk6
- The key of the 6th pairv6
- The value of the 6th pairk7
- The key of the 7th pairv7
- The value of the 7th pairk8
- The key of the 8th pairv8
- The value of the 8th pairk9
- The key of the 9th pairv9
- The value of the 9th pairk10
- The key of the 10th pairv10
- The value of the 10th pairTreeMap
instance containing the given entriespublic static java.lang.Void run(java.lang.Runnable unit)
unit
of work and returns Void
. This is helpful when a return value is expected,
e.g. by Match
:
Match(i).of(
Case($(is(0)), i -> run(() -> System.out.println("zero"))),
Case($(is(1)), i -> run(() -> System.out.println("one"))),
Case($(), o -> run(() -> System.out.println("many")))
)
unit
- A block of code to be run.Void
, namely null
public static <T,U> Iterator<U> For(java.lang.Iterable<T> ts, java.util.function.Function<? super T,? extends java.lang.Iterable<U>> f)
Iterator.ofAll(ts).flatMap(f)
which allows us to write real for-comprehensions using
For(...).yield(...)
.
Example:
For(getPersons(), person ->
For(person.getTweets(), tweet ->
For(tweet.getReplies())
.yield(reply -> person + ", " + tweet + ", " + reply)));
T
- element type of ts
U
- component type of the resulting Iterator
ts
- An iterablef
- A function T -> Iterable<U>
public static <T1> API.For1<T1> For(java.lang.Iterable<T1> ts1)
For
-comprehension of one Iterable.T1
- component type of the 1st Iterablets1
- the 1st IterableFor
-comprehension of arity 1public static <T1,T2> API.For2<T1,T2> For(java.lang.Iterable<T1> ts1, java.lang.Iterable<T2> ts2)
For
-comprehension of two Iterables.T1
- component type of the 1st IterableT2
- component type of the 2nd Iterablets1
- the 1st Iterablets2
- the 2nd IterableFor
-comprehension of arity 2public static <T1,T2,T3> API.For3<T1,T2,T3> For(java.lang.Iterable<T1> ts1, java.lang.Iterable<T2> ts2, java.lang.Iterable<T3> ts3)
For
-comprehension of three Iterables.T1
- component type of the 1st IterableT2
- component type of the 2nd IterableT3
- component type of the 3rd Iterablets1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd IterableFor
-comprehension of arity 3public static <T1,T2,T3,T4> API.For4<T1,T2,T3,T4> For(java.lang.Iterable<T1> ts1, java.lang.Iterable<T2> ts2, java.lang.Iterable<T3> ts3, java.lang.Iterable<T4> ts4)
For
-comprehension of 4 Iterables.T1
- component type of the 1st IterableT2
- component type of the 2nd IterableT3
- component type of the 3rd IterableT4
- component type of the 4th Iterablets1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd Iterablets4
- the 4th IterableFor
-comprehension of arity 4public static <T1,T2,T3,T4,T5> API.For5<T1,T2,T3,T4,T5> For(java.lang.Iterable<T1> ts1, java.lang.Iterable<T2> ts2, java.lang.Iterable<T3> ts3, java.lang.Iterable<T4> ts4, java.lang.Iterable<T5> ts5)
For
-comprehension of 5 Iterables.T1
- component type of the 1st IterableT2
- component type of the 2nd IterableT3
- component type of the 3rd IterableT4
- component type of the 4th IterableT5
- component type of the 5th Iterablets1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd Iterablets4
- the 4th Iterablets5
- the 5th IterableFor
-comprehension of arity 5public static <T1,T2,T3,T4,T5,T6> API.For6<T1,T2,T3,T4,T5,T6> For(java.lang.Iterable<T1> ts1, java.lang.Iterable<T2> ts2, java.lang.Iterable<T3> ts3, java.lang.Iterable<T4> ts4, java.lang.Iterable<T5> ts5, java.lang.Iterable<T6> ts6)
For
-comprehension of 6 Iterables.T1
- component type of the 1st IterableT2
- component type of the 2nd IterableT3
- component type of the 3rd IterableT4
- component type of the 4th IterableT5
- component type of the 5th IterableT6
- component type of the 6th Iterablets1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd Iterablets4
- the 4th Iterablets5
- the 5th Iterablets6
- the 6th IterableFor
-comprehension of arity 6public static <T1,T2,T3,T4,T5,T6,T7> API.For7<T1,T2,T3,T4,T5,T6,T7> For(java.lang.Iterable<T1> ts1, java.lang.Iterable<T2> ts2, java.lang.Iterable<T3> ts3, java.lang.Iterable<T4> ts4, java.lang.Iterable<T5> ts5, java.lang.Iterable<T6> ts6, java.lang.Iterable<T7> ts7)
For
-comprehension of 7 Iterables.T1
- component type of the 1st IterableT2
- component type of the 2nd IterableT3
- component type of the 3rd IterableT4
- component type of the 4th IterableT5
- component type of the 5th IterableT6
- component type of the 6th IterableT7
- component type of the 7th Iterablets1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd Iterablets4
- the 4th Iterablets5
- the 5th Iterablets6
- the 6th Iterablets7
- the 7th IterableFor
-comprehension of arity 7public static <T1,T2,T3,T4,T5,T6,T7,T8> API.For8<T1,T2,T3,T4,T5,T6,T7,T8> For(java.lang.Iterable<T1> ts1, java.lang.Iterable<T2> ts2, java.lang.Iterable<T3> ts3, java.lang.Iterable<T4> ts4, java.lang.Iterable<T5> ts5, java.lang.Iterable<T6> ts6, java.lang.Iterable<T7> ts7, java.lang.Iterable<T8> ts8)
For
-comprehension of 8 Iterables.T1
- component type of the 1st IterableT2
- component type of the 2nd IterableT3
- component type of the 3rd IterableT4
- component type of the 4th IterableT5
- component type of the 5th IterableT6
- component type of the 6th IterableT7
- component type of the 7th IterableT8
- component type of the 8th Iterablets1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd Iterablets4
- the 4th Iterablets5
- the 5th Iterablets6
- the 6th Iterablets7
- the 7th Iterablets8
- the 8th IterableFor
-comprehension of arity 8@GwtIncompatible public static <T> API.Match<T> Match(T value)
T
- type of the valuevalue
- a value to be matchedMatch
instance@GwtIncompatible public static <T,R> API.Match.Case<T,R> Case(API.Match.Pattern0<T> pattern, java.util.function.Function<? super T,? extends R> f)
@GwtIncompatible public static <T,R> API.Match.Case<T,R> Case(API.Match.Pattern0<T> pattern, java.util.function.Supplier<? extends R> supplier)
@GwtIncompatible public static <T,R> API.Match.Case<T,R> Case(API.Match.Pattern0<T> pattern, R retVal)
@GwtIncompatible public static <T,T1,R> API.Match.Case<T,R> Case(API.Match.Pattern1<T,T1> pattern, java.util.function.Function<? super T1,? extends R> f)
@GwtIncompatible public static <T,T1,R> API.Match.Case<T,R> Case(API.Match.Pattern1<T,T1> pattern, java.util.function.Supplier<? extends R> supplier)
@GwtIncompatible public static <T,T1,R> API.Match.Case<T,R> Case(API.Match.Pattern1<T,T1> pattern, R retVal)
@GwtIncompatible public static <T,T1,T2,R> API.Match.Case<T,R> Case(API.Match.Pattern2<T,T1,T2> pattern, java.util.function.BiFunction<? super T1,? super T2,? extends R> f)
@GwtIncompatible public static <T,T1,T2,R> API.Match.Case<T,R> Case(API.Match.Pattern2<T,T1,T2> pattern, java.util.function.Supplier<? extends R> supplier)
@GwtIncompatible public static <T,T1,T2,R> API.Match.Case<T,R> Case(API.Match.Pattern2<T,T1,T2> pattern, R retVal)
@GwtIncompatible public static <T,T1,T2,T3,R> API.Match.Case<T,R> Case(API.Match.Pattern3<T,T1,T2,T3> pattern, Function3<? super T1,? super T2,? super T3,? extends R> f)
@GwtIncompatible public static <T,T1,T2,T3,R> API.Match.Case<T,R> Case(API.Match.Pattern3<T,T1,T2,T3> pattern, java.util.function.Supplier<? extends R> supplier)
@GwtIncompatible public static <T,T1,T2,T3,R> API.Match.Case<T,R> Case(API.Match.Pattern3<T,T1,T2,T3> pattern, R retVal)
@GwtIncompatible public static <T,T1,T2,T3,T4,R> API.Match.Case<T,R> Case(API.Match.Pattern4<T,T1,T2,T3,T4> pattern, Function4<? super T1,? super T2,? super T3,? super T4,? extends R> f)
@GwtIncompatible public static <T,T1,T2,T3,T4,R> API.Match.Case<T,R> Case(API.Match.Pattern4<T,T1,T2,T3,T4> pattern, java.util.function.Supplier<? extends R> supplier)
@GwtIncompatible public static <T,T1,T2,T3,T4,R> API.Match.Case<T,R> Case(API.Match.Pattern4<T,T1,T2,T3,T4> pattern, R retVal)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,R> API.Match.Case<T,R> Case(API.Match.Pattern5<T,T1,T2,T3,T4,T5> pattern, Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> f)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,R> API.Match.Case<T,R> Case(API.Match.Pattern5<T,T1,T2,T3,T4,T5> pattern, java.util.function.Supplier<? extends R> supplier)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,R> API.Match.Case<T,R> Case(API.Match.Pattern5<T,T1,T2,T3,T4,T5> pattern, R retVal)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,T6,R> API.Match.Case<T,R> Case(API.Match.Pattern6<T,T1,T2,T3,T4,T5,T6> pattern, Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> f)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,T6,R> API.Match.Case<T,R> Case(API.Match.Pattern6<T,T1,T2,T3,T4,T5,T6> pattern, java.util.function.Supplier<? extends R> supplier)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,T6,R> API.Match.Case<T,R> Case(API.Match.Pattern6<T,T1,T2,T3,T4,T5,T6> pattern, R retVal)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,T6,T7,R> API.Match.Case<T,R> Case(API.Match.Pattern7<T,T1,T2,T3,T4,T5,T6,T7> pattern, Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> f)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,T6,T7,R> API.Match.Case<T,R> Case(API.Match.Pattern7<T,T1,T2,T3,T4,T5,T6,T7> pattern, java.util.function.Supplier<? extends R> supplier)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,T6,T7,R> API.Match.Case<T,R> Case(API.Match.Pattern7<T,T1,T2,T3,T4,T5,T6,T7> pattern, R retVal)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,T6,T7,T8,R> API.Match.Case<T,R> Case(API.Match.Pattern8<T,T1,T2,T3,T4,T5,T6,T7,T8> pattern, Function8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> f)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,T6,T7,T8,R> API.Match.Case<T,R> Case(API.Match.Pattern8<T,T1,T2,T3,T4,T5,T6,T7,T8> pattern, java.util.function.Supplier<? extends R> supplier)
@GwtIncompatible public static <T,T1,T2,T3,T4,T5,T6,T7,T8,R> API.Match.Case<T,R> Case(API.Match.Pattern8<T,T1,T2,T3,T4,T5,T6,T7,T8> pattern, R retVal)
@GwtIncompatible public static <T> API.Match.Pattern0<T> $()
T
- injected type of the underlying valuePattern0
instance@GwtIncompatible public static <T> API.Match.Pattern0<T> $(T prototype)
T
- type of the prototypeprototype
- the value that should be equal to the underlying objectPattern0
instance@GwtIncompatible public static <T> API.Match.Pattern0<T> $(java.util.function.Predicate<? super T> predicate)
This method is intended to be used with lambdas and method references, for example:
String evenOrOdd(int num) {
return Match(num).of(
Case($(i -> i % 2 == 0), "even"),
Case($(this::isOdd), "odd")
);
}
boolean isOdd(int i) {
return i % 2 == 1;
}
It is also valid to pass Predicate
instances:
Predicate<Integer> isOdd = i -> i % 2 == 1;
Match(num).of(
Case($(i -> i % 2 == 0), "even"),
Case($(isOdd), "odd")
);
Note: Please take care when matching Predicate
instances. In general,
function equality
is an undecidable problem in computer science. In Vavr we are only able to check,
if two functions are the same instance.
However, this code will fail:
Predicate<Integer> p = i -> true;
Match(p).of(
Case($(p), 1) // WRONG! It calls $(Predicate)
);
Instead we have to use Predicates.is(Object)
:
Predicate<Integer> p = i -> true;
Match(p).of(
Case($(is(p)), 1) // CORRECT! It calls $(T)
);
T
- type of the prototypepredicate
- the predicate that tests a given valuePattern0
instanceCopyright © 2017. All Rights Reserved.