Package io.vavr
Class API
java.lang.Object
io.vavr.API
The most basic Vavr functionality is accessed through this API class.
import static io.vavr.API.*;
For-comprehension
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
For-comprehension with one Iterable.static class
For-comprehension with one Future.static class
For-comprehension with one List.static class
For-comprehension with one Option.static class
For-comprehension with one Try.static class
For-comprehension with two Iterables.static class
For-comprehension with two Futures.static class
For-comprehension with two Lists.static class
For-comprehension with two Options.static class
For-comprehension with two Trys.static class
For-comprehension with three Iterables.static class
For-comprehension with three Futures.static class
For-comprehension with three Lists.static class
For-comprehension with three Options.static class
For-comprehension with three Trys.static class
For-comprehension with 4 Iterables.static class
For-comprehension with 4 Futures.static class
API.For4List<T1,
T2, T3, T4> For-comprehension with 4 Lists.static class
For-comprehension with 4 Options.static class
API.For4Try<T1,
T2, T3, T4> For-comprehension with 4 Trys.static class
For-comprehension with 5 Iterables.static class
For-comprehension with 5 Futures.static class
For-comprehension with 5 Lists.static class
For-comprehension with 5 Options.static class
For-comprehension with 5 Trys.static class
For-comprehension with 6 Iterables.static class
For-comprehension with 6 Futures.static class
For-comprehension with 6 Lists.static class
For-comprehension with 6 Options.static class
For-comprehension with 6 Trys.static class
For-comprehension with 7 Iterables.static class
For-comprehension with 7 Futures.static class
For-comprehension with 7 Lists.static class
For-comprehension with 7 Options.static class
For-comprehension with 7 Trys.static class
For-comprehension with 8 Iterables.static class
For-comprehension with 8 Futures.static class
For-comprehension with 8 Lists.static class
For-comprehension with 8 Options.static class
For-comprehension with 8 Trys.static final class
Scala-like structural pattern matching for Java. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> API.Match.Pattern0
<T> $()
Wildcard pattern, matches any value.static <T> API.Match.Pattern0
<T> 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 forArray.empty()
static <T> Array
<T> Array
(T element) Alias forArray.of(Object)
static <T> Array
<T> Array
(T... elements) Alias forArray.of(Object...)
static <T,
R> API.Match.Case <T, R> Case
(API.Match.Pattern0<T> pattern, Function<? super T, ? extends R> f) static <T,
R> API.Match.Case <T, R> Case
(API.Match.Pattern0<T> pattern, Supplier<? extends R> supplier) static <T,
R> API.Match.Case <T, R> Case
(API.Match.Pattern0<T> pattern, R retVal) static <T,
T1, R> API.Match.Case <T, R> Case
(API.Match.Pattern1<T, T1> pattern, Function<? super T1, ? extends R> f) static <T,
T1, R> API.Match.Case <T, R> Case
(API.Match.Pattern1<T, T1> pattern, Supplier<? extends R> supplier) static <T,
T1, R> API.Match.Case <T, R> Case
(API.Match.Pattern1<T, T1> pattern, R retVal) static <T,
T1, T2, R>
API.Match.Case<T, R> Case
(API.Match.Pattern2<T, T1, T2> pattern, BiFunction<? super T1, ? super T2, ? extends R> f) static <T,
T1, T2, R>
API.Match.Case<T, R> Case
(API.Match.Pattern2<T, T1, T2> pattern, Supplier<? extends R> supplier) static <T,
T1, T2, R>
API.Match.Case<T, R> Case
(API.Match.Pattern2<T, T1, T2> pattern, R retVal) 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) static <T,
T1, T2, T3, R>
API.Match.Case<T, R> Case
(API.Match.Pattern3<T, T1, T2, T3> pattern, Supplier<? extends R> supplier) static <T,
T1, T2, T3, R>
API.Match.Case<T, R> Case
(API.Match.Pattern3<T, T1, T2, T3> pattern, R retVal) 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) static <T,
T1, T2, T3, T4, R>
API.Match.Case<T, R> Case
(API.Match.Pattern4<T, T1, T2, T3, T4> pattern, Supplier<? extends R> supplier) static <T,
T1, T2, T3, T4, R>
API.Match.Case<T, R> Case
(API.Match.Pattern4<T, T1, T2, T3, T4> pattern, R retVal) 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) static <T,
T1, T2, T3, T4, T5, R>
API.Match.Case<T, R> Case
(API.Match.Pattern5<T, T1, T2, T3, T4, T5> pattern, Supplier<? extends R> supplier) 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) 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) 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, Supplier<? extends R> supplier) 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) 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) 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, Supplier<? extends R> supplier) 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) 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) 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, Supplier<? extends R> supplier) 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) static CharSeq
CharSeq
(char character) Alias forCharSeq.of(char)
static CharSeq
CharSeq
(char... characters) Alias forCharSeq.of(char...)
static CharSeq
CharSeq
(CharSequence sequence) Alias forCharSeq.of(CharSequence)
static <R> CheckedFunction0
<R> CheckedFunction
(CheckedFunction0<R> methodReference) Alias forCheckedFunction0.of(CheckedFunction0)
static <T1,
R> CheckedFunction1 <T1, R> CheckedFunction
(CheckedFunction1<T1, R> methodReference) Alias forCheckedFunction1.of(CheckedFunction1)
static <T1,
T2, R>
CheckedFunction2<T1, T2, R> CheckedFunction
(CheckedFunction2<T1, T2, R> methodReference) Alias forCheckedFunction2.of(CheckedFunction2)
static <T1,
T2, T3, R>
CheckedFunction3<T1, T2, T3, R> CheckedFunction
(CheckedFunction3<T1, T2, T3, R> methodReference) Alias forCheckedFunction3.of(CheckedFunction3)
static <T1,
T2, T3, T4, R>
CheckedFunction4<T1, T2, T3, T4, R> CheckedFunction
(CheckedFunction4<T1, T2, T3, T4, R> methodReference) Alias forCheckedFunction4.of(CheckedFunction4)
static <T1,
T2, T3, T4, T5, R>
CheckedFunction5<T1, T2, T3, T4, T5, R> CheckedFunction
(CheckedFunction5<T1, T2, T3, T4, T5, R> methodReference) Alias forCheckedFunction5.of(CheckedFunction5)
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) Alias forCheckedFunction6.of(CheckedFunction6)
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) Alias forCheckedFunction7.of(CheckedFunction7)
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) Alias forCheckedFunction8.of(CheckedFunction8)
static <T> Try.Failure
<T> Alias forTry.failure(Throwable)
static <T1> API.For1List
<T1> Creates aFor
-comprehension of one List.static <T1,
T2> API.For2List <T1, T2> Creates aFor
-comprehension of two Lists.static <T1,
T2, T3>
API.For3List<T1, T2, T3> Creates aFor
-comprehension of three Lists.static <T1,
T2, T3, T4>
API.For4List<T1, T2, T3, T4> Creates aFor
-comprehension of 4 Lists.static <T1,
T2, T3, T4, T5>
API.For5List<T1, T2, T3, T4, T5> Creates aFor
-comprehension of 5 Lists.static <T1,
T2, T3, T4, T5, T6>
API.For6List<T1, T2, T3, T4, T5, T6> Creates aFor
-comprehension of 6 Lists.static <T1,
T2, T3, T4, T5, T6, T7>
API.For7List<T1, T2, T3, T4, T5, T6, T7> For
(List<T1> ts1, List<T2> ts2, List<T3> ts3, List<T4> ts4, List<T5> ts5, List<T6> ts6, List<T7> ts7) Creates aFor
-comprehension of 7 Lists.static <T1,
T2, T3, T4, T5, T6, T7, T8>
API.For8List<T1, T2, T3, T4, T5, T6, T7, T8> For
(List<T1> ts1, List<T2> ts2, List<T3> ts3, List<T4> ts4, List<T5> ts5, List<T6> ts6, List<T7> ts7, List<T8> ts8) Creates aFor
-comprehension of 8 Lists.static <T1> API.For1Future
<T1> Creates aFor
-comprehension of one Future.static <T1,
T2> API.For2Future <T1, T2> Creates aFor
-comprehension of two Futures.static <T1,
T2, T3>
API.For3Future<T1, T2, T3> Creates aFor
-comprehension of three Futures.static <T1,
T2, T3, T4>
API.For4Future<T1, T2, T3, T4> Creates aFor
-comprehension of 4 Futures.static <T1,
T2, T3, T4, T5>
API.For5Future<T1, T2, T3, T4, T5> Creates aFor
-comprehension of 5 Futures.static <T1,
T2, T3, T4, T5, T6>
API.For6Future<T1, T2, T3, T4, T5, T6> Creates aFor
-comprehension of 6 Futures.static <T1,
T2, T3, T4, T5, T6, T7>
API.For7Future<T1, T2, T3, T4, T5, T6, T7> For
(Future<T1> ts1, Future<T2> ts2, Future<T3> ts3, Future<T4> ts4, Future<T5> ts5, Future<T6> ts6, Future<T7> ts7) Creates aFor
-comprehension of 7 Futures.static <T1,
T2, T3, T4, T5, T6, T7, T8>
API.For8Future<T1, T2, T3, T4, T5, T6, T7, T8> For
(Future<T1> ts1, Future<T2> ts2, Future<T3> ts3, Future<T4> ts4, Future<T5> ts5, Future<T6> ts6, Future<T7> ts7, Future<T8> ts8) Creates aFor
-comprehension of 8 Futures.static <T1> API.For1Option
<T1> Creates aFor
-comprehension of one Option.static <T1,
T2> API.For2Option <T1, T2> Creates aFor
-comprehension of two Options.static <T1,
T2, T3>
API.For3Option<T1, T2, T3> Creates aFor
-comprehension of three Options.static <T1,
T2, T3, T4>
API.For4Option<T1, T2, T3, T4> Creates aFor
-comprehension of 4 Options.static <T1,
T2, T3, T4, T5>
API.For5Option<T1, T2, T3, T4, T5> Creates aFor
-comprehension of 5 Options.static <T1,
T2, T3, T4, T5, T6>
API.For6Option<T1, T2, T3, T4, T5, T6> Creates aFor
-comprehension of 6 Options.static <T1,
T2, T3, T4, T5, T6, T7>
API.For7Option<T1, T2, T3, T4, T5, T6, T7> For
(Option<T1> ts1, Option<T2> ts2, Option<T3> ts3, Option<T4> ts4, Option<T5> ts5, Option<T6> ts6, Option<T7> ts7) Creates aFor
-comprehension of 7 Options.static <T1,
T2, T3, T4, T5, T6, T7, T8>
API.For8Option<T1, T2, T3, T4, T5, T6, T7, T8> For
(Option<T1> ts1, Option<T2> ts2, Option<T3> ts3, Option<T4> ts4, Option<T5> ts5, Option<T6> ts6, Option<T7> ts7, Option<T8> ts8) Creates aFor
-comprehension of 8 Options.static <T1> API.For1Try
<T1> Creates aFor
-comprehension of one Try.static <T1,
T2> API.For2Try <T1, T2> Creates aFor
-comprehension of two Trys.static <T1,
T2, T3>
API.For3Try<T1, T2, T3> Creates aFor
-comprehension of three Trys.static <T1,
T2, T3, T4>
API.For4Try<T1, T2, T3, T4> Creates aFor
-comprehension of 4 Trys.static <T1,
T2, T3, T4, T5>
API.For5Try<T1, T2, T3, T4, T5> Creates aFor
-comprehension of 5 Trys.static <T1,
T2, T3, T4, T5, T6>
API.For6Try<T1, T2, T3, T4, T5, T6> Creates aFor
-comprehension of 6 Trys.static <T1,
T2, T3, T4, T5, T6, T7>
API.For7Try<T1, T2, T3, T4, T5, T6, T7> Creates aFor
-comprehension of 7 Trys.static <T1,
T2, T3, T4, T5, T6, T7, T8>
API.For8Try<T1, T2, T3, T4, T5, T6, T7, T8> For
(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5, Try<T6> ts6, Try<T7> ts7, Try<T8> ts8) Creates aFor
-comprehension of 8 Trys.static <T,
U> Iterator <U> A shortcut forIterator.ofAll(ts).flatMap(f)
which allows us to write real for-comprehensions usingFor(...).yield(...)
.static <T1> API.For1
<T1> Creates aFor
-comprehension of one Iterable.static <T1,
T2> API.For2 <T1, T2> Creates aFor
-comprehension of two Iterables.static <T1,
T2, T3>
API.For3<T1, T2, T3> Creates aFor
-comprehension of three Iterables.static <T1,
T2, T3, T4>
API.For4<T1, T2, T3, T4> Creates aFor
-comprehension of 4 Iterables.static <T1,
T2, T3, T4, T5>
API.For5<T1, T2, T3, T4, T5> Creates aFor
-comprehension of 5 Iterables.static <T1,
T2, T3, T4, T5, T6>
API.For6<T1, T2, T3, T4, T5, T6> For
(Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3, Iterable<T4> ts4, Iterable<T5> ts5, Iterable<T6> ts6) Creates aFor
-comprehension of 6 Iterables.static <T1,
T2, T3, T4, T5, T6, T7>
API.For7<T1, T2, T3, T4, T5, T6, T7> For
(Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3, Iterable<T4> ts4, Iterable<T5> ts5, Iterable<T6> ts6, Iterable<T7> ts7) Creates aFor
-comprehension of 7 Iterables.static <T1,
T2, T3, T4, T5, T6, T7, T8>
API.For8<T1, T2, T3, T4, T5, T6, T7, T8> For
(Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3, Iterable<T4> ts4, Iterable<T5> ts5, Iterable<T6> ts6, Iterable<T7> ts7, Iterable<T8> ts8) Creates aFor
-comprehension of 8 Iterables.static <R> Function0
<R> Alias forFunction0.of(Function0)
static <T1,
R> Function1 <T1, R> Alias forFunction1.of(Function1)
static <T1,
T2, R>
Function2<T1, T2, R> Alias forFunction2.of(Function2)
static <T1,
T2, T3, R>
Function3<T1, T2, T3, R> Alias forFunction3.of(Function3)
static <T1,
T2, T3, T4, R>
Function4<T1, T2, T3, T4, R> Alias forFunction4.of(Function4)
static <T1,
T2, T3, T4, T5, R>
Function5<T1, T2, T3, T4, T5, R> Alias forFunction5.of(Function5)
static <T1,
T2, T3, T4, T5, T6, R>
Function6<T1, T2, T3, T4, T5, T6, R> Alias forFunction6.of(Function6)
static <T1,
T2, T3, T4, T5, T6, T7, R>
Function7<T1, T2, T3, T4, T5, T6, T7, R> Alias forFunction7.of(Function7)
static <T1,
T2, T3, T4, T5, T6, T7, T8, R>
Function8<T1, T2, T3, T4, T5, T6, T7, T8, R> Alias forFunction8.of(Function8)
static <T> Future
<T> Future
(CheckedFunction0<? extends T> computation) Alias forFuture.of(CheckedFunction0)
static <T> Future
<T> Future
(Executor executorService, CheckedFunction0<? extends T> computation) Alias forFuture.of(Executor, CheckedFunction0)
static <T> Future
<T> Alias forFuture.successful(Executor, Object)
static <T> Future
<T> Future
(T result) Alias forFuture.successful(Object)
static <T> IndexedSeq
<T> Alias forVector.empty()
static <T> IndexedSeq
<T> IndexedSeq
(T element) Alias forVector.of(Object)
static <T> IndexedSeq
<T> IndexedSeq
(T... elements) Alias forVector.of(Object...)
static <E,
T> Validation.Invalid <E, T> Invalid
(E error) Alias forValidation.invalid(Object)
static <T> Lazy
<T> Alias forLazy.of(Supplier)
static <L,
R> Either.Left <L, R> Left
(L left) Alias forEither.left(Object)
static <K,
V> Map <K, V> Alias forLinkedHashMap.empty()
static <K,
V> Map <K, V> Deprecated.Will be removed in a future version.static <K,
V> Map <K, V> LinkedMap
(K k1, V v1) Alias forLinkedHashMap.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 <T> Set
<T> Alias forLinkedHashSet.empty()
static <T> Set
<T> LinkedSet
(T element) Alias forLinkedHashSet.of(Object)
static <T> Set
<T> LinkedSet
(T... elements) Alias forLinkedHashSet.of(Object...)
static <T> List
<T> List()
Alias forList.empty()
static <T> List
<T> List
(T element) Alias forList.of(Object)
static <T> List
<T> List
(T... elements) Alias forList.of(Object...)
static <K,
V> Map <K, V> Map()
Alias forHashMap.empty()
static <K,
V> Map <K, V> Deprecated.Will be removed in a future version.static <K,
V> Map <K, V> Map
(K k1, V v1) Alias forHashMap.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 <T> API.Match
<T> Match
(T value) Entry point of the match API.static <T> Option.None
<T> None()
Alias forOption.none()
static <T> Option
<T> Option
(T value) Alias forOption.of(Object)
static void
Shortcut forSystem.out.print(obj)
.static void
Shortcut forSystem.out.printf(format, args)
.static void
println()
Shortcut forSystem.out.println()
.static void
Shortcut forSystem.out.println(obj)
.static <T extends Comparable<? super T>>
PriorityQueue<T> Alias forPriorityQueue.empty()
static <T extends Comparable<? super T>>
PriorityQueue<T> PriorityQueue
(Comparator<? super T> comparator) Alias forPriorityQueue.empty(Comparator)
static <T> PriorityQueue
<T> PriorityQueue
(Comparator<? super T> comparator, T element) Alias forPriorityQueue.of(Comparator, Object)
static <T> PriorityQueue
<T> PriorityQueue
(Comparator<? super T> comparator, T... elements) Alias forPriorityQueue.of(Comparator, Object...)
static <T extends Comparable<? super T>>
PriorityQueue<T> PriorityQueue
(T element) Alias forPriorityQueue.of(Comparable)
static <T extends Comparable<? super T>>
PriorityQueue<T> PriorityQueue
(T... elements) Alias forPriorityQueue.of(Comparable...)
static <T> Queue
<T> Queue()
Alias forQueue.empty()
static <T> Queue
<T> Queue
(T element) Alias forQueue.of(Object)
static <T> Queue
<T> Queue
(T... elements) Alias forQueue.of(Object...)
static <L,
R> Either.Right <L, R> Right
(R right) Alias forEither.right(Object)
static Void
Runs aunit
of work and returnsVoid
.static <T> Seq
<T> Seq()
Alias forList.empty()
static <T> Seq
<T> Seq
(T element) Alias forList.of(Object)
static <T> Seq
<T> Seq
(T... elements) Alias forList.of(Object...)
static <T> Set
<T> Set()
Alias forHashSet.empty()
static <T> Set
<T> Set
(T element) Alias forHashSet.of(Object)
static <T> Set
<T> Set
(T... elements) Alias forHashSet.of(Object...)
static <T> Option.Some
<T> Some
(T value) Alias forOption.some(Object)
static <K extends Comparable<? super K>,
V>
SortedMap<K, V> Alias forTreeMap.empty()
static <K extends Comparable<? super K>,
V>
SortedMap<K, V> Deprecated.Will be removed in a future version.static <K,
V> SortedMap <K, V> SortedMap
(Comparator<? super K> keyComparator) Alias forTreeMap.empty(Comparator)
static <K,
V> SortedMap <K, V> SortedMap
(Comparator<? super K> keyComparator, Tuple2<? extends K, ? extends V>... entries) Deprecated.Will be removed in a future version.static <K,
V> SortedMap <K, V> SortedMap
(Comparator<? super K> keyComparator, K key, V value) Alias forTreeMap.of(Comparator, Object, Object)
static <K extends Comparable<? super K>,
V>
SortedMap<K, V> Deprecated.Will be removed in a future version.static <K extends Comparable<? super K>,
V>
SortedMap<K, V> SortedMap
(K k1, V v1) Alias forTreeMap.of(Comparable, Object)
static <K extends Comparable<? super K>,
V>
SortedMap<K, V> SortedMap
(K k1, V v1, K k2, V v2) static <K extends Comparable<? super K>,
V>
SortedMap<K, V> SortedMap
(K k1, V v1, K k2, V v2, K k3, V v3) static <K extends Comparable<? super K>,
V>
SortedMap<K, V> SortedMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) static <K extends 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) static <K extends 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) static <K extends 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) static <K extends 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) static <K extends 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) static <K extends 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) static <T extends Comparable<? super T>>
SortedSet<T> Alias forTreeSet.empty()
static <T extends Comparable<? super T>>
SortedSet<T> SortedSet
(Comparator<? super T> comparator) Alias forTreeSet.empty(Comparator)
static <T> SortedSet
<T> SortedSet
(Comparator<? super T> comparator, T element) Alias forTreeSet.of(Comparator, Object)
static <T> SortedSet
<T> SortedSet
(Comparator<? super T> comparator, T... elements) Alias forTreeSet.of(Comparator, Object...)
static <T extends Comparable<? super T>>
SortedSet<T> SortedSet
(T element) Alias forTreeSet.of(Comparable)
static <T extends Comparable<? super T>>
SortedSet<T> SortedSet
(T... elements) Alias forTreeSet.of(Comparable...)
static <T> Stream
<T> Stream()
Alias forStream.empty()
static <T> Stream
<T> Stream
(T element) Alias forStream.of(Object)
static <T> Stream
<T> Stream
(T... elements) Alias forStream.of(Object...)
static <T> Try.Success
<T> Success
(T value) Alias forTry.success(Object)
static <T> T
TODO()
A temporary replacement for an implementations used during prototyping.static <T> T
A temporary replacement for an implementations used during prototyping.static <T> Try
<T> Try
(CheckedFunction0<? extends T> supplier) Alias forTry.of(CheckedFunction0)
static Tuple0
Tuple()
Alias forTuple.empty()
static <T1> Tuple1
<T1> Tuple
(T1 t1) Alias forTuple.of(Object)
Creates a tuple of one element.static <T1,
T2> Tuple2 <T1, T2> Tuple
(T1 t1, T2 t2) Alias forTuple.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 forTuple.of(Object, Object, Object)
Creates a tuple of three elements.static <T1,
T2, T3, T4>
Tuple4<T1, T2, T3, T4> Tuple
(T1 t1, T2 t2, T3 t3, T4 t4) Alias forTuple.of(Object, Object, Object, Object)
Creates a tuple of 4 elements.static <T1,
T2, T3, T4, T5>
Tuple5<T1, T2, T3, T4, T5> Tuple
(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) Alias forTuple.of(Object, Object, Object, Object, Object)
Creates a tuple of 5 elements.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) Alias forTuple.of(Object, Object, Object, Object, Object, Object)
Creates a tuple of 6 elements.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) Alias forTuple.of(Object, Object, Object, Object, Object, Object, Object)
Creates a tuple of 7 elements.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) Alias forTuple.of(Object, Object, Object, Object, Object, Object, Object, Object)
Creates a tuple of 8 elements.static <R> Function0
<R> unchecked
(CheckedFunction0<R> f) Alias forCheckedFunction0.unchecked()
static <T1,
R> Function1 <T1, R> unchecked
(CheckedFunction1<T1, R> f) Alias forCheckedFunction1.unchecked()
static <T1,
T2, R>
Function2<T1, T2, R> unchecked
(CheckedFunction2<T1, T2, R> f) Alias forCheckedFunction2.unchecked()
static <T1,
T2, T3, R>
Function3<T1, T2, T3, R> unchecked
(CheckedFunction3<T1, T2, T3, R> f) Alias forCheckedFunction3.unchecked()
static <T1,
T2, T3, T4, R>
Function4<T1, T2, T3, T4, R> unchecked
(CheckedFunction4<T1, T2, T3, T4, R> f) Alias forCheckedFunction4.unchecked()
static <T1,
T2, T3, T4, T5, R>
Function5<T1, T2, T3, T4, T5, R> unchecked
(CheckedFunction5<T1, T2, T3, T4, T5, R> f) Alias forCheckedFunction5.unchecked()
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) Alias forCheckedFunction6.unchecked()
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) Alias forCheckedFunction7.unchecked()
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) Alias forCheckedFunction8.unchecked()
static <E,
T> Validation.Valid <E, T> Valid
(T value) Alias forValidation.valid(Object)
static <T> Vector
<T> Vector()
Alias forVector.empty()
static <T> Vector
<T> Vector
(T element) Alias forVector.of(Object)
static <T> Vector
<T> Vector
(T... elements) Alias forVector.of(Object...)
-
Constructor Details
-
API
private API()
-
-
Method Details
-
TODO
public static <T> T TODO()A temporary replacement for an implementations used during prototyping.Example:
public HttpResponse getResponse(HttpRequest request) { return TODO(); } final HttpResponse response = getHttpResponse(TODO());
- Type Parameters:
T
- The result type of the missing implementation.- Returns:
- Nothing - this methods always throws.
- Throws:
NotImplementedError
- when this methods is called- See Also:
-
TODO
A temporary replacement for an implementations used during prototyping.Example:
public HttpResponse getResponse(HttpRequest request) { return TODO("fake response"); } final HttpResponse response = getHttpResponse(TODO("fake request"));
- Type Parameters:
T
- The result type of the missing implementation.- Parameters:
msg
- An error message- Returns:
- Nothing - this methods always throws.
- Throws:
NotImplementedError
- when this methods is called- See Also:
-
print
Shortcut forSystem.out.print(obj)
. SeePrintStream.print(Object)
.- Parameters:
obj
- TheObject
to be printed
-
printf
Shortcut forSystem.out.printf(format, args)
. SeePrintStream.printf(String, Object...)
.- Parameters:
format
- A format string as described inFormatter
.args
- Arguments referenced by the format specifiers
-
println
Shortcut forSystem.out.println(obj)
. SeePrintStream.println(Object)
.- Parameters:
obj
- TheObject
to be printed
-
println
public static void println()Shortcut forSystem.out.println()
. SeePrintStream.println()
. -
Function
Alias forFunction0.of(Function0)
- Type Parameters:
R
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
Function0
-
Function
Alias forFunction1.of(Function1)
- Type Parameters:
T1
- type of the 1st argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
Function1
-
Function
Alias forFunction2.of(Function2)
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
Function2
-
Function
Alias forFunction3.of(Function3)
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
Function3
-
Function
public static <T1,T2, Function4<T1,T3, T4, R> T2, FunctionT3, T4, R> (Function4<T1, T2, T3, T4, R> methodReference) Alias forFunction4.of(Function4)
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
Function4
-
Function
public static <T1,T2, Function5<T1,T3, T4, T5, R> T2, FunctionT3, T4, T5, R> (Function5<T1, T2, T3, T4, T5, R> methodReference) Alias forFunction5.of(Function5)
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
Function5
-
Function
public static <T1,T2, Function6<T1,T3, T4, T5, T6, R> T2, FunctionT3, T4, T5, T6, R> (Function6<T1, T2, T3, T4, T5, T6, R> methodReference) Alias forFunction6.of(Function6)
- Type Parameters:
T1
- 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 argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
Function6
-
Function
public static <T1,T2, Function7<T1,T3, T4, T5, T6, T7, R> T2, FunctionT3, T4, T5, T6, T7, R> (Function7<T1, T2, T3, T4, T5, T6, T7, R> methodReference) Alias forFunction7.of(Function7)
- Type Parameters:
T1
- 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 argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
Function7
-
Function
public static <T1,T2, Function8<T1,T3, T4, T5, T6, T7, T8, R> T2, FunctionT3, T4, T5, T6, T7, T8, R> (Function8<T1, T2, T3, T4, T5, T6, T7, T8, R> methodReference) Alias forFunction8.of(Function8)
- Type Parameters:
T1
- 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 argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
Function8
-
CheckedFunction
Alias forCheckedFunction0.of(CheckedFunction0)
- Type Parameters:
R
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
CheckedFunction0
-
CheckedFunction
public static <T1,R> CheckedFunction1<T1,R> CheckedFunction(CheckedFunction1<T1, R> methodReference) Alias forCheckedFunction1.of(CheckedFunction1)
- Type Parameters:
T1
- type of the 1st argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
CheckedFunction1
-
CheckedFunction
public static <T1,T2, CheckedFunction2<T1,R> T2, CheckedFunctionR> (CheckedFunction2<T1, T2, R> methodReference) Alias forCheckedFunction2.of(CheckedFunction2)
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
CheckedFunction2
-
CheckedFunction
public static <T1,T2, CheckedFunction3<T1,T3, R> T2, CheckedFunctionT3, R> (CheckedFunction3<T1, T2, T3, R> methodReference) Alias forCheckedFunction3.of(CheckedFunction3)
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
CheckedFunction3
-
CheckedFunction
public static <T1,T2, CheckedFunction4<T1,T3, T4, R> T2, CheckedFunctionT3, T4, R> (CheckedFunction4<T1, T2, T3, T4, R> methodReference) Alias forCheckedFunction4.of(CheckedFunction4)
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
CheckedFunction4
-
CheckedFunction
public static <T1,T2, CheckedFunction5<T1,T3, T4, T5, R> T2, CheckedFunctionT3, T4, T5, R> (CheckedFunction5<T1, T2, T3, T4, T5, R> methodReference) Alias forCheckedFunction5.of(CheckedFunction5)
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
CheckedFunction5
-
CheckedFunction
public static <T1,T2, CheckedFunction6<T1,T3, T4, T5, T6, R> T2, CheckedFunctionT3, T4, T5, T6, R> (CheckedFunction6<T1, T2, T3, T4, T5, T6, R> methodReference) Alias forCheckedFunction6.of(CheckedFunction6)
- Type Parameters:
T1
- 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 argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
CheckedFunction6
-
CheckedFunction
public static <T1,T2, CheckedFunction7<T1,T3, T4, T5, T6, T7, R> T2, CheckedFunctionT3, T4, T5, T6, T7, R> (CheckedFunction7<T1, T2, T3, T4, T5, T6, T7, R> methodReference) Alias forCheckedFunction7.of(CheckedFunction7)
- Type Parameters:
T1
- 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 argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
CheckedFunction7
-
CheckedFunction
public static <T1,T2, CheckedFunction8<T1,T3, T4, T5, T6, T7, T8, R> T2, CheckedFunctionT3, T4, T5, T6, T7, T8, R> (CheckedFunction8<T1, T2, T3, T4, T5, T6, T7, T8, R> methodReference) Alias forCheckedFunction8.of(CheckedFunction8)
- Type Parameters:
T1
- 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 argumentR
- return type- Parameters:
methodReference
- A method reference- Returns:
- A
CheckedFunction8
-
unchecked
Alias forCheckedFunction0.unchecked()
- Type Parameters:
R
- return type- Parameters:
f
- A method reference- Returns:
- An unchecked wrapper of supplied
CheckedFunction0
-
unchecked
Alias forCheckedFunction1.unchecked()
- Type Parameters:
T1
- type of the 1st argumentR
- return type- Parameters:
f
- A method reference- Returns:
- An unchecked wrapper of supplied
CheckedFunction1
-
unchecked
Alias forCheckedFunction2.unchecked()
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentR
- return type- Parameters:
f
- A method reference- Returns:
- An unchecked wrapper of supplied
CheckedFunction2
-
unchecked
Alias forCheckedFunction3.unchecked()
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentR
- return type- Parameters:
f
- A method reference- Returns:
- An unchecked wrapper of supplied
CheckedFunction3
-
unchecked
public static <T1,T2, Function4<T1,T3, T4, R> T2, uncheckedT3, T4, R> (CheckedFunction4<T1, T2, T3, T4, R> f) Alias forCheckedFunction4.unchecked()
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentR
- return type- Parameters:
f
- A method reference- Returns:
- An unchecked wrapper of supplied
CheckedFunction4
-
unchecked
public static <T1,T2, Function5<T1,T3, T4, T5, R> T2, uncheckedT3, T4, T5, R> (CheckedFunction5<T1, T2, T3, T4, T5, R> f) Alias forCheckedFunction5.unchecked()
- Type Parameters:
T1
- type of the 1st argumentT2
- type of the 2nd argumentT3
- type of the 3rd argumentT4
- type of the 4th argumentT5
- type of the 5th argumentR
- return type- Parameters:
f
- A method reference- Returns:
- An unchecked wrapper of supplied
CheckedFunction5
-
unchecked
public static <T1,T2, Function6<T1,T3, T4, T5, T6, R> T2, uncheckedT3, T4, T5, T6, R> (CheckedFunction6<T1, T2, T3, T4, T5, T6, R> f) Alias forCheckedFunction6.unchecked()
- Type Parameters:
T1
- 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 argumentR
- return type- Parameters:
f
- A method reference- Returns:
- An unchecked wrapper of supplied
CheckedFunction6
-
unchecked
public static <T1,T2, Function7<T1,T3, T4, T5, T6, T7, R> T2, uncheckedT3, T4, T5, T6, T7, R> (CheckedFunction7<T1, T2, T3, T4, T5, T6, T7, R> f) Alias forCheckedFunction7.unchecked()
- Type Parameters:
T1
- 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 argumentR
- return type- Parameters:
f
- A method reference- Returns:
- An unchecked wrapper of supplied
CheckedFunction7
-
unchecked
public static <T1,T2, Function8<T1,T3, T4, T5, T6, T7, T8, R> T2, uncheckedT3, T4, T5, T6, T7, T8, R> (CheckedFunction8<T1, T2, T3, T4, T5, T6, T7, T8, R> f) Alias forCheckedFunction8.unchecked()
- Type Parameters:
T1
- 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 argumentR
- return type- Parameters:
f
- A method reference- Returns:
- An unchecked wrapper of supplied
CheckedFunction8
-
Tuple
Alias forTuple.empty()
- Returns:
- the empty tuple.
-
Tuple
Alias forTuple.of(Object)
Creates a tuple of one element.- Type Parameters:
T1
- type of the 1st element- Parameters:
t1
- the 1st element- Returns:
- a tuple of one element.
-
Tuple
Alias forTuple.of(Object, Object)
Creates a tuple of two elements.- Type Parameters:
T1
- type of the 1st elementT2
- type of the 2nd element- Parameters:
t1
- the 1st elementt2
- the 2nd element- Returns:
- a tuple of two elements.
-
Tuple
Alias forTuple.of(Object, Object, Object)
Creates a tuple of three elements.- Type Parameters:
T1
- type of the 1st elementT2
- type of the 2nd elementT3
- type of the 3rd element- Parameters:
t1
- the 1st elementt2
- the 2nd elementt3
- the 3rd element- Returns:
- a tuple of three elements.
-
Tuple
Alias forTuple.of(Object, Object, Object, Object)
Creates a tuple of 4 elements.- Type Parameters:
T1
- type of the 1st elementT2
- type of the 2nd elementT3
- type of the 3rd elementT4
- type of the 4th element- Parameters:
t1
- the 1st elementt2
- the 2nd elementt3
- the 3rd elementt4
- the 4th element- Returns:
- a tuple of 4 elements.
-
Tuple
Alias forTuple.of(Object, Object, Object, Object, Object)
Creates a tuple of 5 elements.- Type Parameters:
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 element- Parameters:
t1
- the 1st elementt2
- the 2nd elementt3
- the 3rd elementt4
- the 4th elementt5
- the 5th element- Returns:
- a tuple of 5 elements.
-
Tuple
public static <T1,T2, Tuple6<T1,T3, T4, T5, T6> T2, TupleT3, T4, T5, T6> (T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6) Alias forTuple.of(Object, Object, Object, Object, Object, Object)
Creates a tuple of 6 elements.- Type Parameters:
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 element- Parameters:
t1
- the 1st elementt2
- the 2nd elementt3
- the 3rd elementt4
- the 4th elementt5
- the 5th elementt6
- the 6th element- Returns:
- a tuple of 6 elements.
-
Tuple
public static <T1,T2, Tuple7<T1,T3, T4, T5, T6, T7> T2, TupleT3, T4, T5, T6, T7> (T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7) Alias forTuple.of(Object, Object, Object, Object, Object, Object, Object)
Creates a tuple of 7 elements.- Type Parameters:
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 element- Parameters:
t1
- the 1st elementt2
- the 2nd elementt3
- the 3rd elementt4
- the 4th elementt5
- the 5th elementt6
- the 6th elementt7
- the 7th element- Returns:
- a tuple of 7 elements.
-
Tuple
public static <T1,T2, Tuple8<T1,T3, T4, T5, T6, T7, T8> T2, TupleT3, T4, T5, T6, T7, T8> (T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8) Alias forTuple.of(Object, Object, Object, Object, Object, Object, Object, Object)
Creates a tuple of 8 elements.- Type Parameters:
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 element- Parameters:
t1
- the 1st elementt2
- the 2nd elementt3
- the 3rd elementt4
- the 4th elementt5
- the 5th elementt6
- the 6th elementt7
- the 7th elementt8
- the 8th element- Returns:
- a tuple of 8 elements.
-
Right
Alias forEither.right(Object)
- Type Parameters:
L
- Type of left value.R
- Type of right value.- Parameters:
right
- The value.- Returns:
- A new
Either.Right
instance.
-
Left
Alias forEither.left(Object)
- Type Parameters:
L
- Type of left value.R
- Type of right value.- Parameters:
left
- The value.- Returns:
- A new
Either.Left
instance.
-
Future
Alias forFuture.of(CheckedFunction0)
- Type Parameters:
T
- Type of the computation result.- Parameters:
computation
- A computation.- Returns:
- A new
Future
instance. - Throws:
NullPointerException
- if computation is null.
-
Future
public static <T> Future<T> Future(Executor executorService, CheckedFunction0<? extends T> computation) Alias forFuture.of(Executor, CheckedFunction0)
- Type Parameters:
T
- Type of the computation result.- Parameters:
executorService
- An executor service.computation
- A computation.- Returns:
- A new
Future
instance. - Throws:
NullPointerException
- if one of executorService or computation is null.
-
Future
Alias forFuture.successful(Object)
- Type Parameters:
T
- The value type of a successful result.- Parameters:
result
- The result.- Returns:
- A succeeded
Future
.
-
Future
Alias forFuture.successful(Executor, Object)
- Type Parameters:
T
- The value type of a successful result.- Parameters:
executorService
- AnExecutorService
.result
- The result.- Returns:
- A succeeded
Future
. - Throws:
NullPointerException
- if executorService is null
-
Lazy
Alias forLazy.of(Supplier)
- Type Parameters:
T
- type of the lazy value- Parameters:
supplier
- A supplier- Returns:
- A new instance of
Lazy
-
Option
Alias forOption.of(Object)
- Type Parameters:
T
- type of the value- Parameters:
value
- A value- Returns:
Option.Some
if value is notnull
,Option.None
otherwise
-
Some
Alias forOption.some(Object)
- Type Parameters:
T
- type of the value- Parameters:
value
- A value- Returns:
Option.Some
-
None
Alias forOption.none()
- Type Parameters:
T
- component type- Returns:
- the singleton instance of
Option.None
-
Try
Alias forTry.of(CheckedFunction0)
- Type Parameters:
T
- Component type- Parameters:
supplier
- A checked supplier- Returns:
Try.Success
if no exception occurs, otherwiseTry.Failure
if an exception occurs callingsupplier.get()
.
-
Success
Alias forTry.success(Object)
- Type Parameters:
T
- Type of the givenvalue
.- Parameters:
value
- A value.- Returns:
- A new
Try.Success
.
-
Failure
Alias forTry.failure(Throwable)
- Type Parameters:
T
- Component type of theTry
.- Parameters:
exception
- An exception.- Returns:
- A new
Try.Failure
.
-
Valid
Alias forValidation.valid(Object)
- Type Parameters:
E
- type of the errorT
- type of the givenvalue
- Parameters:
value
- A value- Returns:
Validation.Valid
- Throws:
NullPointerException
- if value is null
-
Invalid
Alias forValidation.invalid(Object)
- Type Parameters:
E
- type of the givenerror
T
- type of the value- Parameters:
error
- An error- Returns:
Validation.Invalid
- Throws:
NullPointerException
- if error is null
-
CharSeq
Alias forCharSeq.of(char)
- Parameters:
character
- A character.- Returns:
- A new
CharSeq
instance containing the given element
-
CharSeq
Alias forCharSeq.of(char...)
- Parameters:
characters
- Zero or more characters.- Returns:
- A new
CharSeq
instance containing the given characters in the same order. - Throws:
NullPointerException
- ifelements
is null
-
CharSeq
Alias forCharSeq.of(CharSequence)
- Parameters:
sequence
-CharSequence
instance.- Returns:
- A new
CharSeq
instance
-
PriorityQueue
Alias forPriorityQueue.empty()
- Type Parameters:
T
- Component type of element.- Returns:
- A new
PriorityQueue
empty instance
-
PriorityQueue
public static <T extends Comparable<? super T>> PriorityQueue<T> PriorityQueue(Comparator<? super T> comparator) Alias forPriorityQueue.empty(Comparator)
- Type Parameters:
T
- Component type of element.- Parameters:
comparator
- The comparator used to sort the elements- Returns:
- A new
PriorityQueue
empty instance
-
PriorityQueue
Alias forPriorityQueue.of(Comparable)
- Type Parameters:
T
- Component type of element.- Parameters:
element
- An element.- Returns:
- A new
PriorityQueue
instance containing the given element
-
PriorityQueue
Alias forPriorityQueue.of(Comparator, Object)
- Type Parameters:
T
- Component type of element.- Parameters:
comparator
- The comparator used to sort the elementselement
- An element.- Returns:
- A new
PriorityQueue
instance containing the given element
-
PriorityQueue
@SafeVarargs public static <T extends Comparable<? super T>> PriorityQueue<T> PriorityQueue(T... elements) Alias forPriorityQueue.of(Comparable...)
- Type Parameters:
T
- Component type of element.- Parameters:
elements
- Zero or more elements.- Returns:
- A new
PriorityQueue
instance containing the given elements
-
PriorityQueue
@SafeVarargs public static <T> PriorityQueue<T> PriorityQueue(Comparator<? super T> comparator, T... elements) Alias forPriorityQueue.of(Comparator, Object...)
- Type Parameters:
T
- Component type of element.- Parameters:
comparator
- The comparator used to sort the elementselements
- Zero or more elements.- Returns:
- A new
PriorityQueue
instance containing the given elements
-
Seq
Alias forList.empty()
- Type Parameters:
T
- Component type of element.- Returns:
- A singleton instance of empty
List
-
Seq
Alias forList.of(Object)
- Type Parameters:
T
- Component type of element.- Parameters:
element
- An element.- Returns:
- A new
List
instance containing the given element
-
Seq
Alias forList.of(Object...)
- Type Parameters:
T
- Component type of elements.- Parameters:
elements
- Zero or more elements.- Returns:
- A new
List
instance containing the given elements - Throws:
NullPointerException
- ifelements
is null
-
IndexedSeq
Alias forVector.empty()
- Type Parameters:
T
- Component type of element.- Returns:
- A singleton instance of empty
Vector
-
IndexedSeq
Alias forVector.of(Object)
- Type Parameters:
T
- Component type of element.- Parameters:
element
- An element.- Returns:
- A new
Vector
instance containing the given element
-
IndexedSeq
Alias forVector.of(Object...)
- Type Parameters:
T
- Component type of elements.- Parameters:
elements
- Zero or more elements.- Returns:
- A new
Vector
instance containing the given elements - Throws:
NullPointerException
- ifelements
is null
-
Array
Alias forArray.empty()
- Type Parameters:
T
- Component type of element.- Returns:
- A singleton instance of empty
Array
-
Array
Alias forArray.of(Object)
- Type Parameters:
T
- Component type of element.- Parameters:
element
- An element.- Returns:
- A new
Array
instance containing the given element
-
Array
Alias forArray.of(Object...)
- Type Parameters:
T
- Component type of elements.- Parameters:
elements
- Zero or more elements.- Returns:
- A new
Array
instance containing the given elements - Throws:
NullPointerException
- ifelements
is null
-
List
Alias forList.empty()
- Type Parameters:
T
- Component type of element.- Returns:
- A singleton instance of empty
List
-
List
Alias forList.of(Object)
- Type Parameters:
T
- Component type of element.- Parameters:
element
- An element.- Returns:
- A new
List
instance containing the given element
-
List
Alias forList.of(Object...)
- Type Parameters:
T
- Component type of elements.- Parameters:
elements
- Zero or more elements.- Returns:
- A new
List
instance containing the given elements - Throws:
NullPointerException
- ifelements
is null
-
Queue
Alias forQueue.empty()
- Type Parameters:
T
- Component type of element.- Returns:
- A singleton instance of empty
Queue
-
Queue
Alias forQueue.of(Object)
- Type Parameters:
T
- Component type of element.- Parameters:
element
- An element.- Returns:
- A new
Queue
instance containing the given element
-
Queue
Alias forQueue.of(Object...)
- Type Parameters:
T
- Component type of elements.- Parameters:
elements
- Zero or more elements.- Returns:
- A new
Queue
instance containing the given elements - Throws:
NullPointerException
- ifelements
is null
-
Stream
Alias forStream.empty()
- Type Parameters:
T
- Component type of element.- Returns:
- A singleton instance of empty
Stream
-
Stream
Alias forStream.of(Object)
- Type Parameters:
T
- Component type of element.- Parameters:
element
- An element.- Returns:
- A new
Stream
instance containing the given element
-
Stream
Alias forStream.of(Object...)
- Type Parameters:
T
- Component type of elements.- Parameters:
elements
- Zero or more elements.- Returns:
- A new
Stream
instance containing the given elements - Throws:
NullPointerException
- ifelements
is null
-
Vector
Alias forVector.empty()
- Type Parameters:
T
- Component type of element.- Returns:
- A singleton instance of empty
Vector
-
Vector
Alias forVector.of(Object)
- Type Parameters:
T
- Component type of element.- Parameters:
element
- An element.- Returns:
- A new
Vector
instance containing the given element
-
Vector
Alias forVector.of(Object...)
- Type Parameters:
T
- Component type of elements.- Parameters:
elements
- Zero or more elements.- Returns:
- A new
Vector
instance containing the given elements - Throws:
NullPointerException
- ifelements
is null
-
Set
Alias forHashSet.empty()
- Type Parameters:
T
- Component type of element.- Returns:
- A singleton instance of empty
HashSet
-
Set
Alias forHashSet.of(Object)
- Type Parameters:
T
- Component type of element.- Parameters:
element
- An element.- Returns:
- A new
HashSet
instance containing the given element
-
Set
Alias forHashSet.of(Object...)
- Type Parameters:
T
- Component type of elements.- Parameters:
elements
- Zero or more elements.- Returns:
- A new
HashSet
instance containing the given elements - Throws:
NullPointerException
- ifelements
is null
-
LinkedSet
Alias forLinkedHashSet.empty()
- Type Parameters:
T
- Component type of element.- Returns:
- A singleton instance of empty
LinkedHashSet
-
LinkedSet
Alias forLinkedHashSet.of(Object)
- Type Parameters:
T
- Component type of element.- Parameters:
element
- An element.- Returns:
- A new
LinkedHashSet
instance containing the given element
-
LinkedSet
Alias forLinkedHashSet.of(Object...)
- Type Parameters:
T
- Component type of elements.- Parameters:
elements
- Zero or more elements.- Returns:
- A new
LinkedHashSet
instance containing the given elements - Throws:
NullPointerException
- ifelements
is null
-
SortedSet
Alias forTreeSet.empty()
- Type Parameters:
T
- Component type of element.- Returns:
- A new
TreeSet
empty instance
-
SortedSet
public static <T extends Comparable<? super T>> SortedSet<T> SortedSet(Comparator<? super T> comparator) Alias forTreeSet.empty(Comparator)
- Type Parameters:
T
- Component type of element.- Parameters:
comparator
- The comparator used to sort the elements- Returns:
- A new
TreeSet
empty instance
-
SortedSet
Alias forTreeSet.of(Comparable)
- Type Parameters:
T
- Component type of element.- Parameters:
element
- An element.- Returns:
- A new
TreeSet
instance containing the given element
-
SortedSet
Alias forTreeSet.of(Comparator, Object)
- Type Parameters:
T
- Component type of element.- Parameters:
comparator
- The comparator used to sort the elementselement
- An element.- Returns:
- A new
TreeSet
instance containing the given element
-
SortedSet
Alias forTreeSet.of(Comparable...)
- Type Parameters:
T
- Component type of element.- Parameters:
elements
- Zero or more elements.- Returns:
- A new
TreeSet
instance containing the given elements
-
SortedSet
@SafeVarargs public static <T> SortedSet<T> SortedSet(Comparator<? super T> comparator, T... elements) Alias forTreeSet.of(Comparator, Object...)
- Type Parameters:
T
- Component type of element.- Parameters:
comparator
- The comparator used to sort the elementselements
- Zero or more elements.- Returns:
- A new
TreeSet
instance containing the given elements
-
Map
Alias forHashMap.empty()
- Type Parameters:
K
- The key type.V
- The value type.- Returns:
- A singleton instance of empty
HashMap
-
Map
@Deprecated @SafeVarargs public static <K,V> Map<K,V> Map(Tuple2<? extends K, ? extends V>... entries) Deprecated.Will be removed in a future version.Alias forHashMap.ofEntries(Tuple2...)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
entries
- Map entries.- Returns:
- A new
HashMap
instance containing the given entries
-
Map
Alias forHashMap.of(Object, Object)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
k1
- The keyv1
- The value- Returns:
- A new
HashMap
instance containing the given entries
-
Map
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pair- Returns:
- A new
HashMap
instance containing the given entries
-
Map
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
HashMap
instance containing the given entries
-
Map
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
HashMap
instance containing the given entries
-
Map
Alias forHashMap.of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
HashMap
instance containing the given entries
-
Map
public 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
HashMap
instance containing the given entries
-
Map
public 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
HashMap
instance containing the given entries
-
Map
public 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
HashMap
instance containing the given entries
-
Map
public 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
HashMap
instance containing the given entries
-
Map
public 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
HashMap
instance containing the given entries
-
LinkedMap
Alias forLinkedHashMap.empty()
- Type Parameters:
K
- The key type.V
- The value type.- Returns:
- A singleton instance of empty
LinkedHashMap
-
LinkedMap
@Deprecated @SafeVarargs public static <K,V> Map<K,V> LinkedMap(Tuple2<? extends K, ? extends V>... entries) Deprecated.Will be removed in a future version.Alias forLinkedHashMap.ofEntries(Tuple2...)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
entries
- Map entries.- Returns:
- A new
LinkedHashMap
instance containing the given entries
-
LinkedMap
Alias forLinkedHashMap.of(Object, Object)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
k1
- The keyv1
- The value- Returns:
- A new
LinkedHashMap
instance containing the given entries
-
LinkedMap
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pair- Returns:
- A new
LinkedHashMap
instance containing the given entries
-
LinkedMap
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
LinkedHashMap
instance containing the given entries
-
LinkedMap
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
LinkedHashMap
instance containing the given entries
-
LinkedMap
Alias forLinkedHashMap.of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
LinkedHashMap
instance containing the given entries
-
LinkedMap
public 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
LinkedHashMap
instance containing the given entries
-
LinkedMap
public 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
LinkedHashMap
instance containing the given entries
-
LinkedMap
public 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
LinkedHashMap
instance containing the given entries
-
LinkedMap
public 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
LinkedHashMap
instance containing the given entries
-
LinkedMap
public 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
LinkedHashMap
instance containing the given entries
-
SortedMap
Alias forTreeMap.empty()
- Type Parameters:
K
- The key type.V
- The value type.- Returns:
- A new empty
TreeMap
instance
-
SortedMap
Alias forTreeMap.empty(Comparator)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
keyComparator
- The comparator used to sort the entries by their key- Returns:
- A new empty
TreeMap
instance
-
SortedMap
Alias forTreeMap.of(Comparator, Object, Object)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
keyComparator
- The comparator used to sort the entries by their keykey
- A singleton map key.value
- A singleton map value.- Returns:
- A new
TreeMap
instance containing the given entry
-
SortedMap
@Deprecated @SafeVarargs public static <K extends Comparable<? super K>,V> SortedMap<K,V> SortedMap(Tuple2<? extends K, ? extends V>... entries) Deprecated.Will be removed in a future version.Alias forTreeMap.ofEntries(Tuple2...)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
entries
- Map entries.- Returns:
- A new
TreeMap
instance containing the given entries
-
SortedMap
@Deprecated @SafeVarargs public static <K,V> SortedMap<K,V> SortedMap(Comparator<? super K> keyComparator, Tuple2<? extends K, ? extends V>... entries) Deprecated.Will be removed in a future version.Alias forTreeMap.ofEntries(Comparator, Tuple2...)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
keyComparator
- The comparator used to sort the entries by their keyentries
- Map entries.- Returns:
- A new
TreeMap
instance containing the given entry
-
SortedMap
@Deprecated public static <K extends Comparable<? super K>,V> SortedMap<K,V> SortedMap(Map<? extends K, ? extends V> map) Deprecated.Will be removed in a future version.Alias forTreeMap.ofAll(java.util.Map)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
map
- A map entry.- Returns:
- A new
TreeMap
instance containing the given map
-
SortedMap
Alias forTreeMap.of(Comparable, Object)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
k1
- The keyv1
- The value- Returns:
- A new
TreeMap
instance containing the given entries
-
SortedMap
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
k1
- The key of the 1st pairv1
- The value of the 1st pairk2
- The key of the 2nd pairv2
- The value of the 2nd pair- Returns:
- A new
TreeMap
instance containing the given entries
-
SortedMap
public static <K extends Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1, K k2, V v2, K k3, V v3) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
TreeMap
instance containing the given entries
-
SortedMap
public static <K extends Comparable<? super K>,V> SortedMap<K,V> SortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Alias forTreeMap.of(Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object)
- Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
TreeMap
instance containing the given entries
-
SortedMap
public static <K extends 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
TreeMap
instance containing the given entries
-
SortedMap
public static <K extends 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
TreeMap
instance containing the given entries
-
SortedMap
public static <K extends 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
TreeMap
instance containing the given entries
-
SortedMap
public static <K extends 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
TreeMap
instance containing the given entries
-
SortedMap
public static <K extends 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
TreeMap
instance containing the given entries
-
SortedMap
public static <K extends 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) - Type Parameters:
K
- The key type.V
- The value type.- Parameters:
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 pair- Returns:
- A new
TreeMap
instance containing the given entries
-
run
Runs aunit
of work and returnsVoid
. This is helpful when a return value is expected, e.g. byMatch
: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"))) )
- Parameters:
unit
- A block of code to be run.- Returns:
- the single instance of
Void
, namelynull
-
For
A shortcut forIterator.ofAll(ts).flatMap(f)
which allows us to write real for-comprehensions usingFor(...).yield(...)
.Example:
For(getPersons(), person -> For(person.getTweets(), tweet -> For(tweet.getReplies()) .yield(reply -> person + ", " + tweet + ", " + reply)));
- Type Parameters:
T
- element type ofts
U
- component type of the resultingIterator
- Parameters:
ts
- An iterablef
- A functionT -> Iterable<U>
- Returns:
- A new Iterator
-
For
Creates aFor
-comprehension of one Iterable.- Type Parameters:
T1
- component type of the 1st Iterable- Parameters:
ts1
- the 1st Iterable- Returns:
- a new
For
-comprehension of arity 1
-
For
Creates aFor
-comprehension of two Iterables.- Type Parameters:
T1
- component type of the 1st IterableT2
- component type of the 2nd Iterable- Parameters:
ts1
- the 1st Iterablets2
- the 2nd Iterable- Returns:
- a new
For
-comprehension of arity 2
-
For
public static <T1,T2, API.For3<T1,T3> T2, ForT3> (Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3) Creates aFor
-comprehension of three Iterables.- Type Parameters:
T1
- component type of the 1st IterableT2
- component type of the 2nd IterableT3
- component type of the 3rd Iterable- Parameters:
ts1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd Iterable- Returns:
- a new
For
-comprehension of arity 3
-
For
public static <T1,T2, API.For4<T1,T3, T4> T2, ForT3, T4> (Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3, Iterable<T4> ts4) Creates aFor
-comprehension of 4 Iterables.- Type Parameters:
T1
- component type of the 1st IterableT2
- component type of the 2nd IterableT3
- component type of the 3rd IterableT4
- component type of the 4th Iterable- Parameters:
ts1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd Iterablets4
- the 4th Iterable- Returns:
- a new
For
-comprehension of arity 4
-
For
public static <T1,T2, API.For5<T1,T3, T4, T5> T2, ForT3, T4, T5> (Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3, Iterable<T4> ts4, Iterable<T5> ts5) Creates aFor
-comprehension of 5 Iterables.- Type Parameters:
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 Iterable- Parameters:
ts1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd Iterablets4
- the 4th Iterablets5
- the 5th Iterable- Returns:
- a new
For
-comprehension of arity 5
-
For
public static <T1,T2, API.For6<T1,T3, T4, T5, T6> T2, ForT3, T4, T5, T6> (Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3, Iterable<T4> ts4, Iterable<T5> ts5, Iterable<T6> ts6) Creates aFor
-comprehension of 6 Iterables.- Type Parameters:
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 Iterable- Parameters:
ts1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd Iterablets4
- the 4th Iterablets5
- the 5th Iterablets6
- the 6th Iterable- Returns:
- a new
For
-comprehension of arity 6
-
For
public static <T1,T2, API.For7<T1,T3, T4, T5, T6, T7> T2, ForT3, T4, T5, T6, T7> (Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3, Iterable<T4> ts4, Iterable<T5> ts5, Iterable<T6> ts6, Iterable<T7> ts7) Creates aFor
-comprehension of 7 Iterables.- Type Parameters:
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 Iterable- Parameters:
ts1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd Iterablets4
- the 4th Iterablets5
- the 5th Iterablets6
- the 6th Iterablets7
- the 7th Iterable- Returns:
- a new
For
-comprehension of arity 7
-
For
public static <T1,T2, API.For8<T1,T3, T4, T5, T6, T7, T8> T2, ForT3, T4, T5, T6, T7, T8> (Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3, Iterable<T4> ts4, Iterable<T5> ts5, Iterable<T6> ts6, Iterable<T7> ts7, Iterable<T8> ts8) Creates aFor
-comprehension of 8 Iterables.- Type Parameters:
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 Iterable- Parameters:
ts1
- the 1st Iterablets2
- the 2nd Iterablets3
- the 3rd Iterablets4
- the 4th Iterablets5
- the 5th Iterablets6
- the 6th Iterablets7
- the 7th Iterablets8
- the 8th Iterable- Returns:
- a new
For
-comprehension of arity 8
-
For
Creates aFor
-comprehension of one Option.- Type Parameters:
T1
- component type of the 1st Option- Parameters:
ts1
- the 1st Option- Returns:
- a new
For
-comprehension of arity 1
-
For
Creates aFor
-comprehension of two Options.- Type Parameters:
T1
- component type of the 1st OptionT2
- component type of the 2nd Option- Parameters:
ts1
- the 1st Optionts2
- the 2nd Option- Returns:
- a new
For
-comprehension of arity 2
-
For
public static <T1,T2, API.For3Option<T1,T3> T2, ForT3> (Option<T1> ts1, Option<T2> ts2, Option<T3> ts3) Creates aFor
-comprehension of three Options.- Type Parameters:
T1
- component type of the 1st OptionT2
- component type of the 2nd OptionT3
- component type of the 3rd Option- Parameters:
ts1
- the 1st Optionts2
- the 2nd Optionts3
- the 3rd Option- Returns:
- a new
For
-comprehension of arity 3
-
For
public static <T1,T2, API.For4Option<T1,T3, T4> T2, ForT3, T4> (Option<T1> ts1, Option<T2> ts2, Option<T3> ts3, Option<T4> ts4) Creates aFor
-comprehension of 4 Options.- Type Parameters:
T1
- component type of the 1st OptionT2
- component type of the 2nd OptionT3
- component type of the 3rd OptionT4
- component type of the 4th Option- Parameters:
ts1
- the 1st Optionts2
- the 2nd Optionts3
- the 3rd Optionts4
- the 4th Option- Returns:
- a new
For
-comprehension of arity 4
-
For
public static <T1,T2, API.For5Option<T1,T3, T4, T5> T2, ForT3, T4, T5> (Option<T1> ts1, Option<T2> ts2, Option<T3> ts3, Option<T4> ts4, Option<T5> ts5) Creates aFor
-comprehension of 5 Options.- Type Parameters:
T1
- component type of the 1st OptionT2
- component type of the 2nd OptionT3
- component type of the 3rd OptionT4
- component type of the 4th OptionT5
- component type of the 5th Option- Parameters:
ts1
- the 1st Optionts2
- the 2nd Optionts3
- the 3rd Optionts4
- the 4th Optionts5
- the 5th Option- Returns:
- a new
For
-comprehension of arity 5
-
For
public static <T1,T2, API.For6Option<T1,T3, T4, T5, T6> T2, ForT3, T4, T5, T6> (Option<T1> ts1, Option<T2> ts2, Option<T3> ts3, Option<T4> ts4, Option<T5> ts5, Option<T6> ts6) Creates aFor
-comprehension of 6 Options.- Type Parameters:
T1
- component type of the 1st OptionT2
- component type of the 2nd OptionT3
- component type of the 3rd OptionT4
- component type of the 4th OptionT5
- component type of the 5th OptionT6
- component type of the 6th Option- Parameters:
ts1
- the 1st Optionts2
- the 2nd Optionts3
- the 3rd Optionts4
- the 4th Optionts5
- the 5th Optionts6
- the 6th Option- Returns:
- a new
For
-comprehension of arity 6
-
For
public static <T1,T2, API.For7Option<T1,T3, T4, T5, T6, T7> T2, ForT3, T4, T5, T6, T7> (Option<T1> ts1, Option<T2> ts2, Option<T3> ts3, Option<T4> ts4, Option<T5> ts5, Option<T6> ts6, Option<T7> ts7) Creates aFor
-comprehension of 7 Options.- Type Parameters:
T1
- component type of the 1st OptionT2
- component type of the 2nd OptionT3
- component type of the 3rd OptionT4
- component type of the 4th OptionT5
- component type of the 5th OptionT6
- component type of the 6th OptionT7
- component type of the 7th Option- Parameters:
ts1
- the 1st Optionts2
- the 2nd Optionts3
- the 3rd Optionts4
- the 4th Optionts5
- the 5th Optionts6
- the 6th Optionts7
- the 7th Option- Returns:
- a new
For
-comprehension of arity 7
-
For
public static <T1,T2, API.For8Option<T1,T3, T4, T5, T6, T7, T8> T2, ForT3, T4, T5, T6, T7, T8> (Option<T1> ts1, Option<T2> ts2, Option<T3> ts3, Option<T4> ts4, Option<T5> ts5, Option<T6> ts6, Option<T7> ts7, Option<T8> ts8) Creates aFor
-comprehension of 8 Options.- Type Parameters:
T1
- component type of the 1st OptionT2
- component type of the 2nd OptionT3
- component type of the 3rd OptionT4
- component type of the 4th OptionT5
- component type of the 5th OptionT6
- component type of the 6th OptionT7
- component type of the 7th OptionT8
- component type of the 8th Option- Parameters:
ts1
- the 1st Optionts2
- the 2nd Optionts3
- the 3rd Optionts4
- the 4th Optionts5
- the 5th Optionts6
- the 6th Optionts7
- the 7th Optionts8
- the 8th Option- Returns:
- a new
For
-comprehension of arity 8
-
For
Creates aFor
-comprehension of one Future.- Type Parameters:
T1
- component type of the 1st Future- Parameters:
ts1
- the 1st Future- Returns:
- a new
For
-comprehension of arity 1
-
For
Creates aFor
-comprehension of two Futures.- Type Parameters:
T1
- component type of the 1st FutureT2
- component type of the 2nd Future- Parameters:
ts1
- the 1st Futurets2
- the 2nd Future- Returns:
- a new
For
-comprehension of arity 2
-
For
public static <T1,T2, API.For3Future<T1,T3> T2, ForT3> (Future<T1> ts1, Future<T2> ts2, Future<T3> ts3) Creates aFor
-comprehension of three Futures.- Type Parameters:
T1
- component type of the 1st FutureT2
- component type of the 2nd FutureT3
- component type of the 3rd Future- Parameters:
ts1
- the 1st Futurets2
- the 2nd Futurets3
- the 3rd Future- Returns:
- a new
For
-comprehension of arity 3
-
For
public static <T1,T2, API.For4Future<T1,T3, T4> T2, ForT3, T4> (Future<T1> ts1, Future<T2> ts2, Future<T3> ts3, Future<T4> ts4) Creates aFor
-comprehension of 4 Futures.- Type Parameters:
T1
- component type of the 1st FutureT2
- component type of the 2nd FutureT3
- component type of the 3rd FutureT4
- component type of the 4th Future- Parameters:
ts1
- the 1st Futurets2
- the 2nd Futurets3
- the 3rd Futurets4
- the 4th Future- Returns:
- a new
For
-comprehension of arity 4
-
For
public static <T1,T2, API.For5Future<T1,T3, T4, T5> T2, ForT3, T4, T5> (Future<T1> ts1, Future<T2> ts2, Future<T3> ts3, Future<T4> ts4, Future<T5> ts5) Creates aFor
-comprehension of 5 Futures.- Type Parameters:
T1
- component type of the 1st FutureT2
- component type of the 2nd FutureT3
- component type of the 3rd FutureT4
- component type of the 4th FutureT5
- component type of the 5th Future- Parameters:
ts1
- the 1st Futurets2
- the 2nd Futurets3
- the 3rd Futurets4
- the 4th Futurets5
- the 5th Future- Returns:
- a new
For
-comprehension of arity 5
-
For
public static <T1,T2, API.For6Future<T1,T3, T4, T5, T6> T2, ForT3, T4, T5, T6> (Future<T1> ts1, Future<T2> ts2, Future<T3> ts3, Future<T4> ts4, Future<T5> ts5, Future<T6> ts6) Creates aFor
-comprehension of 6 Futures.- Type Parameters:
T1
- component type of the 1st FutureT2
- component type of the 2nd FutureT3
- component type of the 3rd FutureT4
- component type of the 4th FutureT5
- component type of the 5th FutureT6
- component type of the 6th Future- Parameters:
ts1
- the 1st Futurets2
- the 2nd Futurets3
- the 3rd Futurets4
- the 4th Futurets5
- the 5th Futurets6
- the 6th Future- Returns:
- a new
For
-comprehension of arity 6
-
For
public static <T1,T2, API.For7Future<T1,T3, T4, T5, T6, T7> T2, ForT3, T4, T5, T6, T7> (Future<T1> ts1, Future<T2> ts2, Future<T3> ts3, Future<T4> ts4, Future<T5> ts5, Future<T6> ts6, Future<T7> ts7) Creates aFor
-comprehension of 7 Futures.- Type Parameters:
T1
- component type of the 1st FutureT2
- component type of the 2nd FutureT3
- component type of the 3rd FutureT4
- component type of the 4th FutureT5
- component type of the 5th FutureT6
- component type of the 6th FutureT7
- component type of the 7th Future- Parameters:
ts1
- the 1st Futurets2
- the 2nd Futurets3
- the 3rd Futurets4
- the 4th Futurets5
- the 5th Futurets6
- the 6th Futurets7
- the 7th Future- Returns:
- a new
For
-comprehension of arity 7
-
For
public static <T1,T2, API.For8Future<T1,T3, T4, T5, T6, T7, T8> T2, ForT3, T4, T5, T6, T7, T8> (Future<T1> ts1, Future<T2> ts2, Future<T3> ts3, Future<T4> ts4, Future<T5> ts5, Future<T6> ts6, Future<T7> ts7, Future<T8> ts8) Creates aFor
-comprehension of 8 Futures.- Type Parameters:
T1
- component type of the 1st FutureT2
- component type of the 2nd FutureT3
- component type of the 3rd FutureT4
- component type of the 4th FutureT5
- component type of the 5th FutureT6
- component type of the 6th FutureT7
- component type of the 7th FutureT8
- component type of the 8th Future- Parameters:
ts1
- the 1st Futurets2
- the 2nd Futurets3
- the 3rd Futurets4
- the 4th Futurets5
- the 5th Futurets6
- the 6th Futurets7
- the 7th Futurets8
- the 8th Future- Returns:
- a new
For
-comprehension of arity 8
-
For
Creates aFor
-comprehension of one Try.- Type Parameters:
T1
- component type of the 1st Try- Parameters:
ts1
- the 1st Try- Returns:
- a new
For
-comprehension of arity 1
-
For
Creates aFor
-comprehension of two Trys.- Type Parameters:
T1
- component type of the 1st TryT2
- component type of the 2nd Try- Parameters:
ts1
- the 1st Tryts2
- the 2nd Try- Returns:
- a new
For
-comprehension of arity 2
-
For
Creates aFor
-comprehension of three Trys.- Type Parameters:
T1
- component type of the 1st TryT2
- component type of the 2nd TryT3
- component type of the 3rd Try- Parameters:
ts1
- the 1st Tryts2
- the 2nd Tryts3
- the 3rd Try- Returns:
- a new
For
-comprehension of arity 3
-
For
public static <T1,T2, API.For4Try<T1,T3, T4> T2, ForT3, T4> (Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4) Creates aFor
-comprehension of 4 Trys.- Type Parameters:
T1
- component type of the 1st TryT2
- component type of the 2nd TryT3
- component type of the 3rd TryT4
- component type of the 4th Try- Parameters:
ts1
- the 1st Tryts2
- the 2nd Tryts3
- the 3rd Tryts4
- the 4th Try- Returns:
- a new
For
-comprehension of arity 4
-
For
public static <T1,T2, API.For5Try<T1,T3, T4, T5> T2, ForT3, T4, T5> (Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5) Creates aFor
-comprehension of 5 Trys.- Type Parameters:
T1
- component type of the 1st TryT2
- component type of the 2nd TryT3
- component type of the 3rd TryT4
- component type of the 4th TryT5
- component type of the 5th Try- Parameters:
ts1
- the 1st Tryts2
- the 2nd Tryts3
- the 3rd Tryts4
- the 4th Tryts5
- the 5th Try- Returns:
- a new
For
-comprehension of arity 5
-
For
public static <T1,T2, API.For6Try<T1,T3, T4, T5, T6> T2, ForT3, T4, T5, T6> (Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5, Try<T6> ts6) Creates aFor
-comprehension of 6 Trys.- Type Parameters:
T1
- component type of the 1st TryT2
- component type of the 2nd TryT3
- component type of the 3rd TryT4
- component type of the 4th TryT5
- component type of the 5th TryT6
- component type of the 6th Try- Parameters:
ts1
- the 1st Tryts2
- the 2nd Tryts3
- the 3rd Tryts4
- the 4th Tryts5
- the 5th Tryts6
- the 6th Try- Returns:
- a new
For
-comprehension of arity 6
-
For
public static <T1,T2, API.For7Try<T1,T3, T4, T5, T6, T7> T2, ForT3, T4, T5, T6, T7> (Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5, Try<T6> ts6, Try<T7> ts7) Creates aFor
-comprehension of 7 Trys.- Type Parameters:
T1
- component type of the 1st TryT2
- component type of the 2nd TryT3
- component type of the 3rd TryT4
- component type of the 4th TryT5
- component type of the 5th TryT6
- component type of the 6th TryT7
- component type of the 7th Try- Parameters:
ts1
- the 1st Tryts2
- the 2nd Tryts3
- the 3rd Tryts4
- the 4th Tryts5
- the 5th Tryts6
- the 6th Tryts7
- the 7th Try- Returns:
- a new
For
-comprehension of arity 7
-
For
public static <T1,T2, API.For8Try<T1,T3, T4, T5, T6, T7, T8> T2, ForT3, T4, T5, T6, T7, T8> (Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5, Try<T6> ts6, Try<T7> ts7, Try<T8> ts8) Creates aFor
-comprehension of 8 Trys.- Type Parameters:
T1
- component type of the 1st TryT2
- component type of the 2nd TryT3
- component type of the 3rd TryT4
- component type of the 4th TryT5
- component type of the 5th TryT6
- component type of the 6th TryT7
- component type of the 7th TryT8
- component type of the 8th Try- Parameters:
ts1
- the 1st Tryts2
- the 2nd Tryts3
- the 3rd Tryts4
- the 4th Tryts5
- the 5th Tryts6
- the 6th Tryts7
- the 7th Tryts8
- the 8th Try- Returns:
- a new
For
-comprehension of arity 8
-
For
Creates aFor
-comprehension of one List.- Type Parameters:
T1
- component type of the 1st List- Parameters:
ts1
- the 1st List- Returns:
- a new
For
-comprehension of arity 1
-
For
Creates aFor
-comprehension of two Lists.- Type Parameters:
T1
- component type of the 1st ListT2
- component type of the 2nd List- Parameters:
ts1
- the 1st Listts2
- the 2nd List- Returns:
- a new
For
-comprehension of arity 2
-
For
Creates aFor
-comprehension of three Lists.- Type Parameters:
T1
- component type of the 1st ListT2
- component type of the 2nd ListT3
- component type of the 3rd List- Parameters:
ts1
- the 1st Listts2
- the 2nd Listts3
- the 3rd List- Returns:
- a new
For
-comprehension of arity 3
-
For
public static <T1,T2, API.For4List<T1,T3, T4> T2, ForT3, T4> (List<T1> ts1, List<T2> ts2, List<T3> ts3, List<T4> ts4) Creates aFor
-comprehension of 4 Lists.- Type Parameters:
T1
- component type of the 1st ListT2
- component type of the 2nd ListT3
- component type of the 3rd ListT4
- component type of the 4th List- Parameters:
ts1
- the 1st Listts2
- the 2nd Listts3
- the 3rd Listts4
- the 4th List- Returns:
- a new
For
-comprehension of arity 4
-
For
public static <T1,T2, API.For5List<T1,T3, T4, T5> T2, ForT3, T4, T5> (List<T1> ts1, List<T2> ts2, List<T3> ts3, List<T4> ts4, List<T5> ts5) Creates aFor
-comprehension of 5 Lists.- Type Parameters:
T1
- component type of the 1st ListT2
- component type of the 2nd ListT3
- component type of the 3rd ListT4
- component type of the 4th ListT5
- component type of the 5th List- Parameters:
ts1
- the 1st Listts2
- the 2nd Listts3
- the 3rd Listts4
- the 4th Listts5
- the 5th List- Returns:
- a new
For
-comprehension of arity 5
-
For
public static <T1,T2, API.For6List<T1,T3, T4, T5, T6> T2, ForT3, T4, T5, T6> (List<T1> ts1, List<T2> ts2, List<T3> ts3, List<T4> ts4, List<T5> ts5, List<T6> ts6) Creates aFor
-comprehension of 6 Lists.- Type Parameters:
T1
- component type of the 1st ListT2
- component type of the 2nd ListT3
- component type of the 3rd ListT4
- component type of the 4th ListT5
- component type of the 5th ListT6
- component type of the 6th List- Parameters:
ts1
- the 1st Listts2
- the 2nd Listts3
- the 3rd Listts4
- the 4th Listts5
- the 5th Listts6
- the 6th List- Returns:
- a new
For
-comprehension of arity 6
-
For
public static <T1,T2, API.For7List<T1,T3, T4, T5, T6, T7> T2, ForT3, T4, T5, T6, T7> (List<T1> ts1, List<T2> ts2, List<T3> ts3, List<T4> ts4, List<T5> ts5, List<T6> ts6, List<T7> ts7) Creates aFor
-comprehension of 7 Lists.- Type Parameters:
T1
- component type of the 1st ListT2
- component type of the 2nd ListT3
- component type of the 3rd ListT4
- component type of the 4th ListT5
- component type of the 5th ListT6
- component type of the 6th ListT7
- component type of the 7th List- Parameters:
ts1
- the 1st Listts2
- the 2nd Listts3
- the 3rd Listts4
- the 4th Listts5
- the 5th Listts6
- the 6th Listts7
- the 7th List- Returns:
- a new
For
-comprehension of arity 7
-
For
public static <T1,T2, API.For8List<T1,T3, T4, T5, T6, T7, T8> T2, ForT3, T4, T5, T6, T7, T8> (List<T1> ts1, List<T2> ts2, List<T3> ts3, List<T4> ts4, List<T5> ts5, List<T6> ts6, List<T7> ts7, List<T8> ts8) Creates aFor
-comprehension of 8 Lists.- Type Parameters:
T1
- component type of the 1st ListT2
- component type of the 2nd ListT3
- component type of the 3rd ListT4
- component type of the 4th ListT5
- component type of the 5th ListT6
- component type of the 6th ListT7
- component type of the 7th ListT8
- component type of the 8th List- Parameters:
ts1
- the 1st Listts2
- the 2nd Listts3
- the 3rd Listts4
- the 4th Listts5
- the 5th Listts6
- the 6th Listts7
- the 7th Listts8
- the 8th List- Returns:
- a new
For
-comprehension of arity 8
-
Match
Entry point of the match API.- Type Parameters:
T
- type of the value- Parameters:
value
- a value to be matched- Returns:
- a new
Match
instance
-
Case
@GwtIncompatible public static <T,R> API.Match.Case<T,R> Case(API.Match.Pattern0<T> pattern, Function<? super T, ? extends R> f) -
Case
@GwtIncompatible public static <T,R> API.Match.Case<T,R> Case(API.Match.Pattern0<T> pattern, Supplier<? extends R> supplier) -
Case
@GwtIncompatible public static <T,R> API.Match.Case<T,R> Case(API.Match.Pattern0<T> pattern, R retVal) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,R> R> Case(API.Match.Pattern1<T, T1> pattern, Function<? super T1, ? extends R> f) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,R> R> Case(API.Match.Pattern1<T, T1> pattern, Supplier<? extends R> supplier) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,R> R> Case(API.Match.Pattern1<T, T1> pattern, R retVal) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, R> R> Case(API.Match.Pattern2<T, T1, T2> pattern, BiFunction<? super T1, ? super T2, ? extends R> f) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, R> R> Case(API.Match.Pattern2<T, T1, T2> pattern, Supplier<? extends R> supplier) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, R> R> Case(API.Match.Pattern2<T, T1, T2> pattern, R retVal) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, R> R> Case(API.Match.Pattern3<T, T1, T2, T3> pattern, Function3<? super T1, ? super T2, ? super T3, ? extends R> f) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, R> R> Case(API.Match.Pattern3<T, T1, T2, T3> pattern, Supplier<? extends R> supplier) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, R> R> Case(API.Match.Pattern3<T, T1, T2, T3> pattern, R retVal) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, R> R> Case(API.Match.Pattern4<T, T1, T2, T3, T4> pattern, Function4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> f) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, R> R> Case(API.Match.Pattern4<T, T1, T2, T3, T4> pattern, Supplier<? extends R> supplier) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, R> R> Case(API.Match.Pattern4<T, T1, T2, T3, T4> pattern, R retVal) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, R> 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) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, R> R> Case(API.Match.Pattern5<T, T1, T2, T3, T4, T5> pattern, Supplier<? extends R> supplier) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, R> R> Case(API.Match.Pattern5<T, T1, T2, T3, T4, T5> pattern, R retVal) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, T6, R> 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) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, T6, R> R> Case(API.Match.Pattern6<T, T1, T2, T3, T4, T5, T6> pattern, Supplier<? extends R> supplier) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, T6, R> R> Case(API.Match.Pattern6<T, T1, T2, T3, T4, T5, T6> pattern, R retVal) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, T6, T7, R> 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) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, T6, T7, R> R> Case(API.Match.Pattern7<T, T1, T2, T3, T4, T5, T6, T7> pattern, Supplier<? extends R> supplier) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, T6, T7, R> R> Case(API.Match.Pattern7<T, T1, T2, T3, T4, T5, T6, T7> pattern, R retVal) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, T6, T7, T8, R> 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) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, T6, T7, T8, R> R> Case(API.Match.Pattern8<T, T1, T2, T3, T4, T5, T6, T7, T8> pattern, Supplier<? extends R> supplier) -
Case
@GwtIncompatible public static <T,T1, API.Match.Case<T,T2, T3, T4, T5, T6, T7, T8, R> R> Case(API.Match.Pattern8<T, T1, T2, T3, T4, T5, T6, T7, T8> pattern, R retVal) -
$
Wildcard pattern, matches any value.- Type Parameters:
T
- injected type of the underlying value- Returns:
- a new
Pattern0
instance
-
$
Value pattern, checks for equality.- Type Parameters:
T
- type of the prototype- Parameters:
prototype
- the value that should be equal to the underlying object- Returns:
- a new
Pattern0
instance
-
$
Guard pattern, checks if a predicate is satisfied.This method is intended to be used with lambdas and method references, for example:
It is also valid to passString 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; }
Predicate
instances:
Note: Please take care when matchingPredicate<Integer> isOdd = i -> i % 2 == 1; Match(num).of( Case($(i -> i % 2 == 0), "even"), Case($(isOdd), "odd") );
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:
Instead we have to usePredicate<Integer> p = i -> true; Match(p).of( Case($(p), 1) // WRONG! It calls $(Predicate) );
Predicates.is(Object)
:Predicate<Integer> p = i -> true; Match(p).of( Case($(is(p)), 1) // CORRECT! It calls $(T) );
- Type Parameters:
T
- type of the prototype- Parameters:
predicate
- the predicate that tests a given value- Returns:
- a new
Pattern0
instance
-