Package io.vavr

Class API

java.lang.Object
io.vavr.API

public final class API extends Object
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.
  • 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

      public static <T> T TODO(String msg)
      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

      public static void print(Object obj)
      Shortcut for System.out.print(obj). See PrintStream.print(Object).
      Parameters:
      obj - The Object to be printed
    • printf

      @GwtIncompatible public static void printf(String format, Object... args)
      Shortcut for System.out.printf(format, args). See PrintStream.printf(String, Object...).
      Parameters:
      format - A format string as described in Formatter.
      args - Arguments referenced by the format specifiers
    • println

      public static void println(Object obj)
      Shortcut for System.out.println(obj). See PrintStream.println(Object).
      Parameters:
      obj - The Object to be printed
    • println

      public static void println()
      Shortcut for System.out.println(). See PrintStream.println().
    • Function

      public static <R> Function0<R> Function(Function0<R> methodReference)
      Type Parameters:
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A Function0
    • Function

      public static <T1, R> Function1<T1,R> Function(Function1<T1,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A Function1
    • Function

      public static <T1, T2, R> Function2<T1,T2,R> Function(Function2<T1,T2,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A Function2
    • Function

      public static <T1, T2, T3, R> Function3<T1,T2,T3,R> Function(Function3<T1,T2,T3,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A Function3
    • Function

      public static <T1, T2, T3, T4, R> Function4<T1,T2,T3,T4,R> Function(Function4<T1,T2,T3,T4,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A Function4
    • Function

      public static <T1, T2, T3, T4, T5, R> Function5<T1,T2,T3,T4,T5,R> Function(Function5<T1,T2,T3,T4,T5,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A Function5
    • Function

      public static <T1, T2, T3, T4, T5, T6, R> Function6<T1,T2,T3,T4,T5,T6,R> Function(Function6<T1,T2,T3,T4,T5,T6,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      T6 - type of the 6th argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A Function6
    • Function

      public static <T1, T2, T3, T4, T5, T6, T7, R> Function7<T1,T2,T3,T4,T5,T6,T7,R> Function(Function7<T1,T2,T3,T4,T5,T6,T7,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      T6 - type of the 6th argument
      T7 - type of the 7th argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A Function7
    • Function

      public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Function8<T1,T2,T3,T4,T5,T6,T7,T8,R> Function(Function8<T1,T2,T3,T4,T5,T6,T7,T8,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      T6 - type of the 6th argument
      T7 - type of the 7th argument
      T8 - type of the 8th argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A Function8
    • CheckedFunction

      public static <R> CheckedFunction0<R> CheckedFunction(CheckedFunction0<R> methodReference)
      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)
      Type Parameters:
      T1 - type of the 1st argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A CheckedFunction1
    • CheckedFunction

      public static <T1, T2, R> CheckedFunction2<T1,T2,R> CheckedFunction(CheckedFunction2<T1,T2,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A CheckedFunction2
    • CheckedFunction

      public static <T1, T2, T3, R> CheckedFunction3<T1,T2,T3,R> CheckedFunction(CheckedFunction3<T1,T2,T3,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A CheckedFunction3
    • CheckedFunction

      public static <T1, T2, T3, T4, R> CheckedFunction4<T1,T2,T3,T4,R> CheckedFunction(CheckedFunction4<T1,T2,T3,T4,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A CheckedFunction4
    • CheckedFunction

      public static <T1, T2, T3, T4, T5, R> CheckedFunction5<T1,T2,T3,T4,T5,R> CheckedFunction(CheckedFunction5<T1,T2,T3,T4,T5,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A CheckedFunction5
    • CheckedFunction

      public static <T1, T2, T3, T4, T5, T6, R> CheckedFunction6<T1,T2,T3,T4,T5,T6,R> CheckedFunction(CheckedFunction6<T1,T2,T3,T4,T5,T6,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      T6 - type of the 6th argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A CheckedFunction6
    • CheckedFunction

      public static <T1, T2, T3, T4, T5, T6, T7, R> CheckedFunction7<T1,T2,T3,T4,T5,T6,T7,R> CheckedFunction(CheckedFunction7<T1,T2,T3,T4,T5,T6,T7,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      T6 - type of the 6th argument
      T7 - type of the 7th argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A CheckedFunction7
    • CheckedFunction

      public static <T1, T2, T3, T4, T5, T6, T7, T8, R> CheckedFunction8<T1,T2,T3,T4,T5,T6,T7,T8,R> CheckedFunction(CheckedFunction8<T1,T2,T3,T4,T5,T6,T7,T8,R> methodReference)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      T6 - type of the 6th argument
      T7 - type of the 7th argument
      T8 - type of the 8th argument
      R - return type
      Parameters:
      methodReference - A method reference
      Returns:
      A CheckedFunction8
    • unchecked

      public static <R> Function0<R> unchecked(CheckedFunction0<R> f)
      Type Parameters:
      R - return type
      Parameters:
      f - A method reference
      Returns:
      An unchecked wrapper of supplied CheckedFunction0
    • unchecked

      public static <T1, R> Function1<T1,R> unchecked(CheckedFunction1<T1,R> f)
      Type Parameters:
      T1 - type of the 1st argument
      R - return type
      Parameters:
      f - A method reference
      Returns:
      An unchecked wrapper of supplied CheckedFunction1
    • unchecked

      public static <T1, T2, R> Function2<T1,T2,R> unchecked(CheckedFunction2<T1,T2,R> f)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      R - return type
      Parameters:
      f - A method reference
      Returns:
      An unchecked wrapper of supplied CheckedFunction2
    • unchecked

      public static <T1, T2, T3, R> Function3<T1,T2,T3,R> unchecked(CheckedFunction3<T1,T2,T3,R> f)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      R - return type
      Parameters:
      f - A method reference
      Returns:
      An unchecked wrapper of supplied CheckedFunction3
    • unchecked

      public static <T1, T2, T3, T4, R> Function4<T1,T2,T3,T4,R> unchecked(CheckedFunction4<T1,T2,T3,T4,R> f)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      R - return type
      Parameters:
      f - A method reference
      Returns:
      An unchecked wrapper of supplied CheckedFunction4
    • unchecked

      public static <T1, T2, T3, T4, T5, R> Function5<T1,T2,T3,T4,T5,R> unchecked(CheckedFunction5<T1,T2,T3,T4,T5,R> f)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      R - return type
      Parameters:
      f - A method reference
      Returns:
      An unchecked wrapper of supplied CheckedFunction5
    • unchecked

      public static <T1, T2, T3, T4, T5, T6, R> Function6<T1,T2,T3,T4,T5,T6,R> unchecked(CheckedFunction6<T1,T2,T3,T4,T5,T6,R> f)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      T6 - type of the 6th argument
      R - return type
      Parameters:
      f - A method reference
      Returns:
      An unchecked wrapper of supplied CheckedFunction6
    • unchecked

      public static <T1, T2, T3, T4, T5, T6, T7, R> Function7<T1,T2,T3,T4,T5,T6,T7,R> unchecked(CheckedFunction7<T1,T2,T3,T4,T5,T6,T7,R> f)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      T6 - type of the 6th argument
      T7 - type of the 7th argument
      R - return type
      Parameters:
      f - A method reference
      Returns:
      An unchecked wrapper of supplied CheckedFunction7
    • unchecked

      public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Function8<T1,T2,T3,T4,T5,T6,T7,T8,R> unchecked(CheckedFunction8<T1,T2,T3,T4,T5,T6,T7,T8,R> f)
      Type Parameters:
      T1 - type of the 1st argument
      T2 - type of the 2nd argument
      T3 - type of the 3rd argument
      T4 - type of the 4th argument
      T5 - type of the 5th argument
      T6 - type of the 6th argument
      T7 - type of the 7th argument
      T8 - type of the 8th argument
      R - return type
      Parameters:
      f - A method reference
      Returns:
      An unchecked wrapper of supplied CheckedFunction8
    • Tuple

      public static Tuple0 Tuple()
      Alias for Tuple.empty()
      Returns:
      the empty tuple.
    • Tuple

      public static <T1> Tuple1<T1> Tuple(T1 t1)
      Alias for Tuple.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

      public static <T1, T2> Tuple2<T1,T2> Tuple(T1 t1, T2 t2)
      Alias for Tuple.of(Object, Object) Creates a tuple of two elements.
      Type Parameters:
      T1 - type of the 1st element
      T2 - type of the 2nd element
      Parameters:
      t1 - the 1st element
      t2 - the 2nd element
      Returns:
      a tuple of two elements.
    • Tuple

      public static <T1, T2, T3> Tuple3<T1,T2,T3> Tuple(T1 t1, T2 t2, T3 t3)
      Alias for Tuple.of(Object, Object, Object) Creates a tuple of three elements.
      Type Parameters:
      T1 - type of the 1st element
      T2 - type of the 2nd element
      T3 - type of the 3rd element
      Parameters:
      t1 - the 1st element
      t2 - the 2nd element
      t3 - the 3rd element
      Returns:
      a tuple of three elements.
    • Tuple

      public static <T1, T2, T3, T4> Tuple4<T1,T2,T3,T4> Tuple(T1 t1, T2 t2, T3 t3, T4 t4)
      Alias for Tuple.of(Object, Object, Object, Object) Creates a tuple of 4 elements.
      Type Parameters:
      T1 - type of the 1st element
      T2 - type of the 2nd element
      T3 - type of the 3rd element
      T4 - type of the 4th element
      Parameters:
      t1 - the 1st element
      t2 - the 2nd element
      t3 - the 3rd element
      t4 - the 4th element
      Returns:
      a tuple of 4 elements.
    • Tuple

      public static <T1, T2, T3, T4, T5> Tuple5<T1,T2,T3,T4,T5> Tuple(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
      Alias for Tuple.of(Object, Object, Object, Object, Object) Creates a tuple of 5 elements.
      Type Parameters:
      T1 - type of the 1st element
      T2 - type of the 2nd element
      T3 - type of the 3rd element
      T4 - type of the 4th element
      T5 - type of the 5th element
      Parameters:
      t1 - the 1st element
      t2 - the 2nd element
      t3 - the 3rd element
      t4 - the 4th element
      t5 - the 5th element
      Returns:
      a tuple of 5 elements.
    • Tuple

      public 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 for Tuple.of(Object, Object, Object, Object, Object, Object) Creates a tuple of 6 elements.
      Type Parameters:
      T1 - type of the 1st element
      T2 - type of the 2nd element
      T3 - type of the 3rd element
      T4 - type of the 4th element
      T5 - type of the 5th element
      T6 - type of the 6th element
      Parameters:
      t1 - the 1st element
      t2 - the 2nd element
      t3 - the 3rd element
      t4 - the 4th element
      t5 - the 5th element
      t6 - the 6th element
      Returns:
      a tuple of 6 elements.
    • Tuple

      public 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)
      Type Parameters:
      T1 - type of the 1st element
      T2 - type of the 2nd element
      T3 - type of the 3rd element
      T4 - type of the 4th element
      T5 - type of the 5th element
      T6 - type of the 6th element
      T7 - type of the 7th element
      Parameters:
      t1 - the 1st element
      t2 - the 2nd element
      t3 - the 3rd element
      t4 - the 4th element
      t5 - the 5th element
      t6 - the 6th element
      t7 - the 7th element
      Returns:
      a tuple of 7 elements.
    • Tuple

      public 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)
      Type Parameters:
      T1 - type of the 1st element
      T2 - type of the 2nd element
      T3 - type of the 3rd element
      T4 - type of the 4th element
      T5 - type of the 5th element
      T6 - type of the 6th element
      T7 - type of the 7th element
      T8 - type of the 8th element
      Parameters:
      t1 - the 1st element
      t2 - the 2nd element
      t3 - the 3rd element
      t4 - the 4th element
      t5 - the 5th element
      t6 - the 6th element
      t7 - the 7th element
      t8 - the 8th element
      Returns:
      a tuple of 8 elements.
    • Right

      public static <L, R> Either.Right<L,R> Right(R right)
      Type Parameters:
      L - Type of left value.
      R - Type of right value.
      Parameters:
      right - The value.
      Returns:
      A new Either.Right instance.
    • Left

      public static <L, R> Either.Left<L,R> Left(L left)
      Type Parameters:
      L - Type of left value.
      R - Type of right value.
      Parameters:
      left - The value.
      Returns:
      A new Either.Left instance.
    • Future

      public static <T> Future<T> Future(CheckedFunction0<? extends T> computation)
      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)
      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

      public static <T> Future<T> Future(T result)
      Type Parameters:
      T - The value type of a successful result.
      Parameters:
      result - The result.
      Returns:
      A succeeded Future.
    • Future

      public static <T> Future<T> Future(Executor executorService, T result)
      Type Parameters:
      T - The value type of a successful result.
      Parameters:
      executorService - An ExecutorService.
      result - The result.
      Returns:
      A succeeded Future.
      Throws:
      NullPointerException - if executorService is null
    • Lazy

      public static <T> Lazy<T> Lazy(Supplier<? extends T> supplier)
      Type Parameters:
      T - type of the lazy value
      Parameters:
      supplier - A supplier
      Returns:
      A new instance of Lazy
    • Option

      public static <T> Option<T> Option(T value)
      Type Parameters:
      T - type of the value
      Parameters:
      value - A value
      Returns:
      Option.Some if value is not null, Option.None otherwise
    • Some

      public static <T> Option.Some<T> Some(T value)
      Type Parameters:
      T - type of the value
      Parameters:
      value - A value
      Returns:
      Option.Some
    • None

      public static <T> Option.None<T> None()
      Alias for Option.none()
      Type Parameters:
      T - component type
      Returns:
      the singleton instance of Option.None
    • Try

      public static <T> Try<T> Try(CheckedFunction0<? extends T> supplier)
      Type Parameters:
      T - Component type
      Parameters:
      supplier - A checked supplier
      Returns:
      Try.Success if no exception occurs, otherwise Try.Failure if an exception occurs calling supplier.get().
    • Success

      public static <T> Try.Success<T> Success(T value)
      Type Parameters:
      T - Type of the given value.
      Parameters:
      value - A value.
      Returns:
      A new Try.Success.
    • Failure

      public static <T> Try.Failure<T> Failure(Throwable exception)
      Type Parameters:
      T - Component type of the Try.
      Parameters:
      exception - An exception.
      Returns:
      A new Try.Failure.
    • Valid

      public static <E, T> Validation.Valid<E,T> Valid(T value)
      Type Parameters:
      E - type of the error
      T - type of the given value
      Parameters:
      value - A value
      Returns:
      Validation.Valid
      Throws:
      NullPointerException - if value is null
    • Invalid

      public static <E, T> Validation.Invalid<E,T> Invalid(E error)
      Type Parameters:
      E - type of the given error
      T - type of the value
      Parameters:
      error - An error
      Returns:
      Validation.Invalid
      Throws:
      NullPointerException - if error is null
    • CharSeq

      public static CharSeq CharSeq(char character)
      Parameters:
      character - A character.
      Returns:
      A new CharSeq instance containing the given element
    • CharSeq

      public static CharSeq CharSeq(char... characters)
      Parameters:
      characters - Zero or more characters.
      Returns:
      A new CharSeq instance containing the given characters in the same order.
      Throws:
      NullPointerException - if elements is null
    • CharSeq

      public static CharSeq CharSeq(CharSequence sequence)
      Parameters:
      sequence - CharSequence instance.
      Returns:
      A new CharSeq instance
    • PriorityQueue

      public static <T extends Comparable<? super T>> PriorityQueue<T> PriorityQueue()
      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)
      Type Parameters:
      T - Component type of element.
      Parameters:
      comparator - The comparator used to sort the elements
      Returns:
      A new PriorityQueue empty instance
    • PriorityQueue

      public static <T extends Comparable<? super T>> PriorityQueue<T> PriorityQueue(T element)
      Type Parameters:
      T - Component type of element.
      Parameters:
      element - An element.
      Returns:
      A new PriorityQueue instance containing the given element
    • PriorityQueue

      public static <T> PriorityQueue<T> PriorityQueue(Comparator<? super T> comparator, T element)
      Type Parameters:
      T - Component type of element.
      Parameters:
      comparator - The comparator used to sort the elements
      element - 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)
      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)
      Type Parameters:
      T - Component type of element.
      Parameters:
      comparator - The comparator used to sort the elements
      elements - Zero or more elements.
      Returns:
      A new PriorityQueue instance containing the given elements
    • Seq

      public static <T> Seq<T> Seq()
      Alias for List.empty()
      Type Parameters:
      T - Component type of element.
      Returns:
      A singleton instance of empty List
    • Seq

      public static <T> Seq<T> Seq(T element)
      Alias for List.of(Object)
      Type Parameters:
      T - Component type of element.
      Parameters:
      element - An element.
      Returns:
      A new List instance containing the given element
    • Seq

      @SafeVarargs public static <T> Seq<T> Seq(T... elements)
      Type Parameters:
      T - Component type of elements.
      Parameters:
      elements - Zero or more elements.
      Returns:
      A new List instance containing the given elements
      Throws:
      NullPointerException - if elements is null
    • IndexedSeq

      public static <T> IndexedSeq<T> IndexedSeq()
      Alias for Vector.empty()
      Type Parameters:
      T - Component type of element.
      Returns:
      A singleton instance of empty Vector
    • IndexedSeq

      public static <T> IndexedSeq<T> IndexedSeq(T element)
      Type Parameters:
      T - Component type of element.
      Parameters:
      element - An element.
      Returns:
      A new Vector instance containing the given element
    • IndexedSeq

      @SafeVarargs public static <T> IndexedSeq<T> IndexedSeq(T... elements)
      Type Parameters:
      T - Component type of elements.
      Parameters:
      elements - Zero or more elements.
      Returns:
      A new Vector instance containing the given elements
      Throws:
      NullPointerException - if elements is null
    • Array

      public static <T> Array<T> Array()
      Alias for Array.empty()
      Type Parameters:
      T - Component type of element.
      Returns:
      A singleton instance of empty Array
    • Array

      public static <T> Array<T> Array(T element)
      Type Parameters:
      T - Component type of element.
      Parameters:
      element - An element.
      Returns:
      A new Array instance containing the given element
    • Array

      @SafeVarargs public static <T> Array<T> Array(T... elements)
      Type Parameters:
      T - Component type of elements.
      Parameters:
      elements - Zero or more elements.
      Returns:
      A new Array instance containing the given elements
      Throws:
      NullPointerException - if elements is null
    • List

      public static <T> List<T> List()
      Alias for List.empty()
      Type Parameters:
      T - Component type of element.
      Returns:
      A singleton instance of empty List
    • List

      public static <T> List<T> List(T element)
      Alias for List.of(Object)
      Type Parameters:
      T - Component type of element.
      Parameters:
      element - An element.
      Returns:
      A new List instance containing the given element
    • List

      @SafeVarargs public static <T> List<T> List(T... elements)
      Type Parameters:
      T - Component type of elements.
      Parameters:
      elements - Zero or more elements.
      Returns:
      A new List instance containing the given elements
      Throws:
      NullPointerException - if elements is null
    • Queue

      public static <T> Queue<T> Queue()
      Alias for Queue.empty()
      Type Parameters:
      T - Component type of element.
      Returns:
      A singleton instance of empty Queue
    • Queue

      public static <T> Queue<T> Queue(T element)
      Type Parameters:
      T - Component type of element.
      Parameters:
      element - An element.
      Returns:
      A new Queue instance containing the given element
    • Queue

      @SafeVarargs public static <T> Queue<T> Queue(T... elements)
      Type Parameters:
      T - Component type of elements.
      Parameters:
      elements - Zero or more elements.
      Returns:
      A new Queue instance containing the given elements
      Throws:
      NullPointerException - if elements is null
    • Stream

      public static <T> Stream<T> Stream()
      Alias for Stream.empty()
      Type Parameters:
      T - Component type of element.
      Returns:
      A singleton instance of empty Stream
    • Stream

      public static <T> Stream<T> Stream(T element)
      Type Parameters:
      T - Component type of element.
      Parameters:
      element - An element.
      Returns:
      A new Stream instance containing the given element
    • Stream

      @SafeVarargs public static <T> Stream<T> Stream(T... elements)
      Type Parameters:
      T - Component type of elements.
      Parameters:
      elements - Zero or more elements.
      Returns:
      A new Stream instance containing the given elements
      Throws:
      NullPointerException - if elements is null
    • Vector

      public static <T> Vector<T> Vector()
      Alias for Vector.empty()
      Type Parameters:
      T - Component type of element.
      Returns:
      A singleton instance of empty Vector
    • Vector

      public static <T> Vector<T> Vector(T element)
      Type Parameters:
      T - Component type of element.
      Parameters:
      element - An element.
      Returns:
      A new Vector instance containing the given element
    • Vector

      @SafeVarargs public static <T> Vector<T> Vector(T... elements)
      Type Parameters:
      T - Component type of elements.
      Parameters:
      elements - Zero or more elements.
      Returns:
      A new Vector instance containing the given elements
      Throws:
      NullPointerException - if elements is null
    • Set

      public static <T> Set<T> Set()
      Alias for HashSet.empty()
      Type Parameters:
      T - Component type of element.
      Returns:
      A singleton instance of empty HashSet
    • Set

      public static <T> Set<T> Set(T element)
      Type Parameters:
      T - Component type of element.
      Parameters:
      element - An element.
      Returns:
      A new HashSet instance containing the given element
    • Set

      @SafeVarargs public static <T> Set<T> Set(T... elements)
      Type Parameters:
      T - Component type of elements.
      Parameters:
      elements - Zero or more elements.
      Returns:
      A new HashSet instance containing the given elements
      Throws:
      NullPointerException - if elements is null
    • LinkedSet

      public static <T> Set<T> LinkedSet()
      Type Parameters:
      T - Component type of element.
      Returns:
      A singleton instance of empty LinkedHashSet
    • LinkedSet

      public static <T> Set<T> LinkedSet(T element)
      Type Parameters:
      T - Component type of element.
      Parameters:
      element - An element.
      Returns:
      A new LinkedHashSet instance containing the given element
    • LinkedSet

      @SafeVarargs public static <T> Set<T> LinkedSet(T... elements)
      Type Parameters:
      T - Component type of elements.
      Parameters:
      elements - Zero or more elements.
      Returns:
      A new LinkedHashSet instance containing the given elements
      Throws:
      NullPointerException - if elements is null
    • SortedSet

      public static <T extends Comparable<? super T>> SortedSet<T> SortedSet()
      Alias for TreeSet.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)
      Type Parameters:
      T - Component type of element.
      Parameters:
      comparator - The comparator used to sort the elements
      Returns:
      A new TreeSet empty instance
    • SortedSet

      public static <T extends Comparable<? super T>> SortedSet<T> SortedSet(T element)
      Type Parameters:
      T - Component type of element.
      Parameters:
      element - An element.
      Returns:
      A new TreeSet instance containing the given element
    • SortedSet

      public static <T> SortedSet<T> SortedSet(Comparator<? super T> comparator, T element)
      Type Parameters:
      T - Component type of element.
      Parameters:
      comparator - The comparator used to sort the elements
      element - An element.
      Returns:
      A new TreeSet instance containing the given element
    • SortedSet

      @SafeVarargs public static <T extends Comparable<? super T>> SortedSet<T> SortedSet(T... elements)
      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)
      Type Parameters:
      T - Component type of element.
      Parameters:
      comparator - The comparator used to sort the elements
      elements - Zero or more elements.
      Returns:
      A new TreeSet instance containing the given elements
    • Map

      public static <K, V> Map<K,V> Map()
      Alias for HashMap.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.
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      entries - Map entries.
      Returns:
      A new HashMap instance containing the given entries
    • Map

      public static <K, V> Map<K,V> Map(K k1, V v1)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key
      v1 - The value
      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)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key of the 1st pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd 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)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key of the 1st pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd 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)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key of the 1st pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th 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)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key of the 1st pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - The value of the 7th pair
      k8 - The key of the 8th pair
      v8 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - The value of the 7th pair
      k8 - The key of the 8th pair
      v8 - The value of the 8th pair
      k9 - The key of the 9th pair
      v9 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - The value of the 7th pair
      k8 - The key of the 8th pair
      v8 - The value of the 8th pair
      k9 - The key of the 9th pair
      v9 - The value of the 9th pair
      k10 - The key of the 10th pair
      v10 - The value of the 10th pair
      Returns:
      A new HashMap instance containing the given entries
    • LinkedMap

      public static <K, V> Map<K,V> LinkedMap()
      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.
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      entries - Map entries.
      Returns:
      A new LinkedHashMap instance containing the given entries
    • LinkedMap

      public static <K, V> Map<K,V> LinkedMap(K k1, V v1)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key
      v1 - The value
      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)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key of the 1st pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd 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)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key of the 1st pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd 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)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key of the 1st pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th 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)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key of the 1st pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - The value of the 7th pair
      k8 - The key of the 8th pair
      v8 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - The value of the 7th pair
      k8 - The key of the 8th pair
      v8 - The value of the 8th pair
      k9 - The key of the 9th pair
      v9 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - The value of the 7th pair
      k8 - The key of the 8th pair
      v8 - The value of the 8th pair
      k9 - The key of the 9th pair
      v9 - The value of the 9th pair
      k10 - The key of the 10th pair
      v10 - The value of the 10th pair
      Returns:
      A new LinkedHashMap instance containing the given entries
    • SortedMap

      public static <K extends Comparable<? super K>, V> SortedMap<K,V> SortedMap()
      Alias for TreeMap.empty()
      Type Parameters:
      K - The key type.
      V - The value type.
      Returns:
      A new empty TreeMap instance
    • SortedMap

      public static <K, V> SortedMap<K,V> SortedMap(Comparator<? super K> keyComparator)
      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

      public static <K, V> SortedMap<K,V> SortedMap(Comparator<? super K> keyComparator, K key, V value)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      keyComparator - The comparator used to sort the entries by their key
      key - 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.
      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.
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      keyComparator - The comparator used to sort the entries by their key
      entries - 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.
      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

      public static <K extends Comparable<? super K>, V> SortedMap<K,V> SortedMap(K k1, V v1)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key
      v1 - The value
      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)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key of the 1st pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - 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)
      Type Parameters:
      K - The key type.
      V - The value type.
      Parameters:
      k1 - The key of the 1st pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - The value of the 7th pair
      k8 - The key of the 8th pair
      v8 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - The value of the 7th pair
      k8 - The key of the 8th pair
      v8 - The value of the 8th pair
      k9 - The key of the 9th pair
      v9 - 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 pair
      v1 - The value of the 1st pair
      k2 - The key of the 2nd pair
      v2 - The value of the 2nd pair
      k3 - The key of the 3rd pair
      v3 - The value of the 3rd pair
      k4 - The key of the 4th pair
      v4 - The value of the 4th pair
      k5 - The key of the 5th pair
      v5 - The value of the 5th pair
      k6 - The key of the 6th pair
      v6 - The value of the 6th pair
      k7 - The key of the 7th pair
      v7 - The value of the 7th pair
      k8 - The key of the 8th pair
      v8 - The value of the 8th pair
      k9 - The key of the 9th pair
      v9 - The value of the 9th pair
      k10 - The key of the 10th pair
      v10 - The value of the 10th pair
      Returns:
      A new TreeMap instance containing the given entries
    • run

      public static Void run(Runnable unit)
      Runs a unit of work and returns Void. This is helpful when a return value is expected, e.g. by Match:
      Match(i).of(
           Case($(is(0)), i -> run(() -> System.out.println("zero"))),
           Case($(is(1)), i -> run(() -> System.out.println("one"))),
           Case($(), o -> run(() -> System.out.println("many")))
       )
      Parameters:
      unit - A block of code to be run.
      Returns:
      the single instance of Void, namely null
    • For

      public static <T, U> Iterator<U> For(Iterable<T> ts, Function<? super T,? extends Iterable<U>> f)
      A shortcut for Iterator.ofAll(ts).flatMap(f) which allows us to write real for-comprehensions using For(...).yield(...).

      Example:

      
       For(getPersons(), person ->
           For(person.getTweets(), tweet ->
               For(tweet.getReplies())
                   .yield(reply -> person + ", " + tweet + ", " + reply)));
       
      Type Parameters:
      T - element type of ts
      U - component type of the resulting Iterator
      Parameters:
      ts - An iterable
      f - A function T -> Iterable<U>
      Returns:
      A new Iterator
    • For

      public static <T1> API.For1<T1> For(Iterable<T1> ts1)
      Creates a For-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

      public static <T1, T2> API.For2<T1,T2> For(Iterable<T1> ts1, Iterable<T2> ts2)
      Creates a For-comprehension of two Iterables.
      Type Parameters:
      T1 - component type of the 1st Iterable
      T2 - component type of the 2nd Iterable
      Parameters:
      ts1 - the 1st Iterable
      ts2 - the 2nd Iterable
      Returns:
      a new For-comprehension of arity 2
    • For

      public static <T1, T2, T3> API.For3<T1,T2,T3> For(Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3)
      Creates a For-comprehension of three Iterables.
      Type Parameters:
      T1 - component type of the 1st Iterable
      T2 - component type of the 2nd Iterable
      T3 - component type of the 3rd Iterable
      Parameters:
      ts1 - the 1st Iterable
      ts2 - the 2nd Iterable
      ts3 - the 3rd Iterable
      Returns:
      a new For-comprehension of arity 3
    • For

      public static <T1, T2, T3, T4> API.For4<T1,T2,T3,T4> For(Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3, Iterable<T4> ts4)
      Creates a For-comprehension of 4 Iterables.
      Type Parameters:
      T1 - component type of the 1st Iterable
      T2 - component type of the 2nd Iterable
      T3 - component type of the 3rd Iterable
      T4 - component type of the 4th Iterable
      Parameters:
      ts1 - the 1st Iterable
      ts2 - the 2nd Iterable
      ts3 - the 3rd Iterable
      ts4 - the 4th Iterable
      Returns:
      a new For-comprehension of arity 4
    • For

      public static <T1, T2, T3, T4, T5> API.For5<T1,T2,T3,T4,T5> For(Iterable<T1> ts1, Iterable<T2> ts2, Iterable<T3> ts3, Iterable<T4> ts4, Iterable<T5> ts5)
      Creates a For-comprehension of 5 Iterables.
      Type Parameters:
      T1 - component type of the 1st Iterable
      T2 - component type of the 2nd Iterable
      T3 - component type of the 3rd Iterable
      T4 - component type of the 4th Iterable
      T5 - component type of the 5th Iterable
      Parameters:
      ts1 - the 1st Iterable
      ts2 - the 2nd Iterable
      ts3 - the 3rd Iterable
      ts4 - the 4th Iterable
      ts5 - the 5th Iterable
      Returns:
      a new For-comprehension of arity 5
    • For

      public 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 a For-comprehension of 6 Iterables.
      Type Parameters:
      T1 - component type of the 1st Iterable
      T2 - component type of the 2nd Iterable
      T3 - component type of the 3rd Iterable
      T4 - component type of the 4th Iterable
      T5 - component type of the 5th Iterable
      T6 - component type of the 6th Iterable
      Parameters:
      ts1 - the 1st Iterable
      ts2 - the 2nd Iterable
      ts3 - the 3rd Iterable
      ts4 - the 4th Iterable
      ts5 - the 5th Iterable
      ts6 - the 6th Iterable
      Returns:
      a new For-comprehension of arity 6
    • For

      public 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 a For-comprehension of 7 Iterables.
      Type Parameters:
      T1 - component type of the 1st Iterable
      T2 - component type of the 2nd Iterable
      T3 - component type of the 3rd Iterable
      T4 - component type of the 4th Iterable
      T5 - component type of the 5th Iterable
      T6 - component type of the 6th Iterable
      T7 - component type of the 7th Iterable
      Parameters:
      ts1 - the 1st Iterable
      ts2 - the 2nd Iterable
      ts3 - the 3rd Iterable
      ts4 - the 4th Iterable
      ts5 - the 5th Iterable
      ts6 - the 6th Iterable
      ts7 - the 7th Iterable
      Returns:
      a new For-comprehension of arity 7
    • For

      public 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 a For-comprehension of 8 Iterables.
      Type Parameters:
      T1 - component type of the 1st Iterable
      T2 - component type of the 2nd Iterable
      T3 - component type of the 3rd Iterable
      T4 - component type of the 4th Iterable
      T5 - component type of the 5th Iterable
      T6 - component type of the 6th Iterable
      T7 - component type of the 7th Iterable
      T8 - component type of the 8th Iterable
      Parameters:
      ts1 - the 1st Iterable
      ts2 - the 2nd Iterable
      ts3 - the 3rd Iterable
      ts4 - the 4th Iterable
      ts5 - the 5th Iterable
      ts6 - the 6th Iterable
      ts7 - the 7th Iterable
      ts8 - the 8th Iterable
      Returns:
      a new For-comprehension of arity 8
    • For

      public static <T1> API.For1Option<T1> For(Option<T1> ts1)
      Creates a For-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

      public static <T1, T2> API.For2Option<T1,T2> For(Option<T1> ts1, Option<T2> ts2)
      Creates a For-comprehension of two Options.
      Type Parameters:
      T1 - component type of the 1st Option
      T2 - component type of the 2nd Option
      Parameters:
      ts1 - the 1st Option
      ts2 - the 2nd Option
      Returns:
      a new For-comprehension of arity 2
    • For

      public static <T1, T2, T3> API.For3Option<T1,T2,T3> For(Option<T1> ts1, Option<T2> ts2, Option<T3> ts3)
      Creates a For-comprehension of three Options.
      Type Parameters:
      T1 - component type of the 1st Option
      T2 - component type of the 2nd Option
      T3 - component type of the 3rd Option
      Parameters:
      ts1 - the 1st Option
      ts2 - the 2nd Option
      ts3 - the 3rd Option
      Returns:
      a new For-comprehension of arity 3
    • For

      public static <T1, T2, T3, T4> API.For4Option<T1,T2,T3,T4> For(Option<T1> ts1, Option<T2> ts2, Option<T3> ts3, Option<T4> ts4)
      Creates a For-comprehension of 4 Options.
      Type Parameters:
      T1 - component type of the 1st Option
      T2 - component type of the 2nd Option
      T3 - component type of the 3rd Option
      T4 - component type of the 4th Option
      Parameters:
      ts1 - the 1st Option
      ts2 - the 2nd Option
      ts3 - the 3rd Option
      ts4 - the 4th Option
      Returns:
      a new For-comprehension of arity 4
    • For

      public static <T1, T2, T3, T4, T5> API.For5Option<T1,T2,T3,T4,T5> For(Option<T1> ts1, Option<T2> ts2, Option<T3> ts3, Option<T4> ts4, Option<T5> ts5)
      Creates a For-comprehension of 5 Options.
      Type Parameters:
      T1 - component type of the 1st Option
      T2 - component type of the 2nd Option
      T3 - component type of the 3rd Option
      T4 - component type of the 4th Option
      T5 - component type of the 5th Option
      Parameters:
      ts1 - the 1st Option
      ts2 - the 2nd Option
      ts3 - the 3rd Option
      ts4 - the 4th Option
      ts5 - the 5th Option
      Returns:
      a new For-comprehension of arity 5
    • For

      public static <T1, T2, T3, T4, T5, T6> API.For6Option<T1,T2,T3,T4,T5,T6> For(Option<T1> ts1, Option<T2> ts2, Option<T3> ts3, Option<T4> ts4, Option<T5> ts5, Option<T6> ts6)
      Creates a For-comprehension of 6 Options.
      Type Parameters:
      T1 - component type of the 1st Option
      T2 - component type of the 2nd Option
      T3 - component type of the 3rd Option
      T4 - component type of the 4th Option
      T5 - component type of the 5th Option
      T6 - component type of the 6th Option
      Parameters:
      ts1 - the 1st Option
      ts2 - the 2nd Option
      ts3 - the 3rd Option
      ts4 - the 4th Option
      ts5 - the 5th Option
      ts6 - the 6th Option
      Returns:
      a new For-comprehension of arity 6
    • For

      public 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 a For-comprehension of 7 Options.
      Type Parameters:
      T1 - component type of the 1st Option
      T2 - component type of the 2nd Option
      T3 - component type of the 3rd Option
      T4 - component type of the 4th Option
      T5 - component type of the 5th Option
      T6 - component type of the 6th Option
      T7 - component type of the 7th Option
      Parameters:
      ts1 - the 1st Option
      ts2 - the 2nd Option
      ts3 - the 3rd Option
      ts4 - the 4th Option
      ts5 - the 5th Option
      ts6 - the 6th Option
      ts7 - the 7th Option
      Returns:
      a new For-comprehension of arity 7
    • For

      public 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 a For-comprehension of 8 Options.
      Type Parameters:
      T1 - component type of the 1st Option
      T2 - component type of the 2nd Option
      T3 - component type of the 3rd Option
      T4 - component type of the 4th Option
      T5 - component type of the 5th Option
      T6 - component type of the 6th Option
      T7 - component type of the 7th Option
      T8 - component type of the 8th Option
      Parameters:
      ts1 - the 1st Option
      ts2 - the 2nd Option
      ts3 - the 3rd Option
      ts4 - the 4th Option
      ts5 - the 5th Option
      ts6 - the 6th Option
      ts7 - the 7th Option
      ts8 - the 8th Option
      Returns:
      a new For-comprehension of arity 8
    • For

      public static <T1> API.For1Future<T1> For(Future<T1> ts1)
      Creates a For-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

      public static <T1, T2> API.For2Future<T1,T2> For(Future<T1> ts1, Future<T2> ts2)
      Creates a For-comprehension of two Futures.
      Type Parameters:
      T1 - component type of the 1st Future
      T2 - component type of the 2nd Future
      Parameters:
      ts1 - the 1st Future
      ts2 - the 2nd Future
      Returns:
      a new For-comprehension of arity 2
    • For

      public static <T1, T2, T3> API.For3Future<T1,T2,T3> For(Future<T1> ts1, Future<T2> ts2, Future<T3> ts3)
      Creates a For-comprehension of three Futures.
      Type Parameters:
      T1 - component type of the 1st Future
      T2 - component type of the 2nd Future
      T3 - component type of the 3rd Future
      Parameters:
      ts1 - the 1st Future
      ts2 - the 2nd Future
      ts3 - the 3rd Future
      Returns:
      a new For-comprehension of arity 3
    • For

      public static <T1, T2, T3, T4> API.For4Future<T1,T2,T3,T4> For(Future<T1> ts1, Future<T2> ts2, Future<T3> ts3, Future<T4> ts4)
      Creates a For-comprehension of 4 Futures.
      Type Parameters:
      T1 - component type of the 1st Future
      T2 - component type of the 2nd Future
      T3 - component type of the 3rd Future
      T4 - component type of the 4th Future
      Parameters:
      ts1 - the 1st Future
      ts2 - the 2nd Future
      ts3 - the 3rd Future
      ts4 - the 4th Future
      Returns:
      a new For-comprehension of arity 4
    • For

      public static <T1, T2, T3, T4, T5> API.For5Future<T1,T2,T3,T4,T5> For(Future<T1> ts1, Future<T2> ts2, Future<T3> ts3, Future<T4> ts4, Future<T5> ts5)
      Creates a For-comprehension of 5 Futures.
      Type Parameters:
      T1 - component type of the 1st Future
      T2 - component type of the 2nd Future
      T3 - component type of the 3rd Future
      T4 - component type of the 4th Future
      T5 - component type of the 5th Future
      Parameters:
      ts1 - the 1st Future
      ts2 - the 2nd Future
      ts3 - the 3rd Future
      ts4 - the 4th Future
      ts5 - the 5th Future
      Returns:
      a new For-comprehension of arity 5
    • For

      public static <T1, T2, T3, T4, T5, T6> API.For6Future<T1,T2,T3,T4,T5,T6> For(Future<T1> ts1, Future<T2> ts2, Future<T3> ts3, Future<T4> ts4, Future<T5> ts5, Future<T6> ts6)
      Creates a For-comprehension of 6 Futures.
      Type Parameters:
      T1 - component type of the 1st Future
      T2 - component type of the 2nd Future
      T3 - component type of the 3rd Future
      T4 - component type of the 4th Future
      T5 - component type of the 5th Future
      T6 - component type of the 6th Future
      Parameters:
      ts1 - the 1st Future
      ts2 - the 2nd Future
      ts3 - the 3rd Future
      ts4 - the 4th Future
      ts5 - the 5th Future
      ts6 - the 6th Future
      Returns:
      a new For-comprehension of arity 6
    • For

      public 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 a For-comprehension of 7 Futures.
      Type Parameters:
      T1 - component type of the 1st Future
      T2 - component type of the 2nd Future
      T3 - component type of the 3rd Future
      T4 - component type of the 4th Future
      T5 - component type of the 5th Future
      T6 - component type of the 6th Future
      T7 - component type of the 7th Future
      Parameters:
      ts1 - the 1st Future
      ts2 - the 2nd Future
      ts3 - the 3rd Future
      ts4 - the 4th Future
      ts5 - the 5th Future
      ts6 - the 6th Future
      ts7 - the 7th Future
      Returns:
      a new For-comprehension of arity 7
    • For

      public 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 a For-comprehension of 8 Futures.
      Type Parameters:
      T1 - component type of the 1st Future
      T2 - component type of the 2nd Future
      T3 - component type of the 3rd Future
      T4 - component type of the 4th Future
      T5 - component type of the 5th Future
      T6 - component type of the 6th Future
      T7 - component type of the 7th Future
      T8 - component type of the 8th Future
      Parameters:
      ts1 - the 1st Future
      ts2 - the 2nd Future
      ts3 - the 3rd Future
      ts4 - the 4th Future
      ts5 - the 5th Future
      ts6 - the 6th Future
      ts7 - the 7th Future
      ts8 - the 8th Future
      Returns:
      a new For-comprehension of arity 8
    • For

      public static <T1> API.For1Try<T1> For(Try<T1> ts1)
      Creates a For-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

      public static <T1, T2> API.For2Try<T1,T2> For(Try<T1> ts1, Try<T2> ts2)
      Creates a For-comprehension of two Trys.
      Type Parameters:
      T1 - component type of the 1st Try
      T2 - component type of the 2nd Try
      Parameters:
      ts1 - the 1st Try
      ts2 - the 2nd Try
      Returns:
      a new For-comprehension of arity 2
    • For

      public static <T1, T2, T3> API.For3Try<T1,T2,T3> For(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3)
      Creates a For-comprehension of three Trys.
      Type Parameters:
      T1 - component type of the 1st Try
      T2 - component type of the 2nd Try
      T3 - component type of the 3rd Try
      Parameters:
      ts1 - the 1st Try
      ts2 - the 2nd Try
      ts3 - the 3rd Try
      Returns:
      a new For-comprehension of arity 3
    • For

      public static <T1, T2, T3, T4> API.For4Try<T1,T2,T3,T4> For(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4)
      Creates a For-comprehension of 4 Trys.
      Type Parameters:
      T1 - component type of the 1st Try
      T2 - component type of the 2nd Try
      T3 - component type of the 3rd Try
      T4 - component type of the 4th Try
      Parameters:
      ts1 - the 1st Try
      ts2 - the 2nd Try
      ts3 - the 3rd Try
      ts4 - the 4th Try
      Returns:
      a new For-comprehension of arity 4
    • For

      public static <T1, T2, T3, T4, T5> API.For5Try<T1,T2,T3,T4,T5> For(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5)
      Creates a For-comprehension of 5 Trys.
      Type Parameters:
      T1 - component type of the 1st Try
      T2 - component type of the 2nd Try
      T3 - component type of the 3rd Try
      T4 - component type of the 4th Try
      T5 - component type of the 5th Try
      Parameters:
      ts1 - the 1st Try
      ts2 - the 2nd Try
      ts3 - the 3rd Try
      ts4 - the 4th Try
      ts5 - the 5th Try
      Returns:
      a new For-comprehension of arity 5
    • For

      public static <T1, T2, T3, T4, T5, T6> API.For6Try<T1,T2,T3,T4,T5,T6> For(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5, Try<T6> ts6)
      Creates a For-comprehension of 6 Trys.
      Type Parameters:
      T1 - component type of the 1st Try
      T2 - component type of the 2nd Try
      T3 - component type of the 3rd Try
      T4 - component type of the 4th Try
      T5 - component type of the 5th Try
      T6 - component type of the 6th Try
      Parameters:
      ts1 - the 1st Try
      ts2 - the 2nd Try
      ts3 - the 3rd Try
      ts4 - the 4th Try
      ts5 - the 5th Try
      ts6 - the 6th Try
      Returns:
      a new For-comprehension of arity 6
    • For

      public static <T1, T2, T3, T4, T5, T6, T7> API.For7Try<T1,T2,T3,T4,T5,T6,T7> For(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5, Try<T6> ts6, Try<T7> ts7)
      Creates a For-comprehension of 7 Trys.
      Type Parameters:
      T1 - component type of the 1st Try
      T2 - component type of the 2nd Try
      T3 - component type of the 3rd Try
      T4 - component type of the 4th Try
      T5 - component type of the 5th Try
      T6 - component type of the 6th Try
      T7 - component type of the 7th Try
      Parameters:
      ts1 - the 1st Try
      ts2 - the 2nd Try
      ts3 - the 3rd Try
      ts4 - the 4th Try
      ts5 - the 5th Try
      ts6 - the 6th Try
      ts7 - the 7th Try
      Returns:
      a new For-comprehension of arity 7
    • For

      public 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 a For-comprehension of 8 Trys.
      Type Parameters:
      T1 - component type of the 1st Try
      T2 - component type of the 2nd Try
      T3 - component type of the 3rd Try
      T4 - component type of the 4th Try
      T5 - component type of the 5th Try
      T6 - component type of the 6th Try
      T7 - component type of the 7th Try
      T8 - component type of the 8th Try
      Parameters:
      ts1 - the 1st Try
      ts2 - the 2nd Try
      ts3 - the 3rd Try
      ts4 - the 4th Try
      ts5 - the 5th Try
      ts6 - the 6th Try
      ts7 - the 7th Try
      ts8 - the 8th Try
      Returns:
      a new For-comprehension of arity 8
    • For

      public static <T1> API.For1List<T1> For(List<T1> ts1)
      Creates a For-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

      public static <T1, T2> API.For2List<T1,T2> For(List<T1> ts1, List<T2> ts2)
      Creates a For-comprehension of two Lists.
      Type Parameters:
      T1 - component type of the 1st List
      T2 - component type of the 2nd List
      Parameters:
      ts1 - the 1st List
      ts2 - the 2nd List
      Returns:
      a new For-comprehension of arity 2
    • For

      public static <T1, T2, T3> API.For3List<T1,T2,T3> For(List<T1> ts1, List<T2> ts2, List<T3> ts3)
      Creates a For-comprehension of three Lists.
      Type Parameters:
      T1 - component type of the 1st List
      T2 - component type of the 2nd List
      T3 - component type of the 3rd List
      Parameters:
      ts1 - the 1st List
      ts2 - the 2nd List
      ts3 - the 3rd List
      Returns:
      a new For-comprehension of arity 3
    • For

      public static <T1, T2, T3, T4> API.For4List<T1,T2,T3,T4> For(List<T1> ts1, List<T2> ts2, List<T3> ts3, List<T4> ts4)
      Creates a For-comprehension of 4 Lists.
      Type Parameters:
      T1 - component type of the 1st List
      T2 - component type of the 2nd List
      T3 - component type of the 3rd List
      T4 - component type of the 4th List
      Parameters:
      ts1 - the 1st List
      ts2 - the 2nd List
      ts3 - the 3rd List
      ts4 - the 4th List
      Returns:
      a new For-comprehension of arity 4
    • For

      public static <T1, T2, T3, T4, T5> API.For5List<T1,T2,T3,T4,T5> For(List<T1> ts1, List<T2> ts2, List<T3> ts3, List<T4> ts4, List<T5> ts5)
      Creates a For-comprehension of 5 Lists.
      Type Parameters:
      T1 - component type of the 1st List
      T2 - component type of the 2nd List
      T3 - component type of the 3rd List
      T4 - component type of the 4th List
      T5 - component type of the 5th List
      Parameters:
      ts1 - the 1st List
      ts2 - the 2nd List
      ts3 - the 3rd List
      ts4 - the 4th List
      ts5 - the 5th List
      Returns:
      a new For-comprehension of arity 5
    • For

      public static <T1, T2, T3, T4, T5, T6> API.For6List<T1,T2,T3,T4,T5,T6> For(List<T1> ts1, List<T2> ts2, List<T3> ts3, List<T4> ts4, List<T5> ts5, List<T6> ts6)
      Creates a For-comprehension of 6 Lists.
      Type Parameters:
      T1 - component type of the 1st List
      T2 - component type of the 2nd List
      T3 - component type of the 3rd List
      T4 - component type of the 4th List
      T5 - component type of the 5th List
      T6 - component type of the 6th List
      Parameters:
      ts1 - the 1st List
      ts2 - the 2nd List
      ts3 - the 3rd List
      ts4 - the 4th List
      ts5 - the 5th List
      ts6 - the 6th List
      Returns:
      a new For-comprehension of arity 6
    • For

      public 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 a For-comprehension of 7 Lists.
      Type Parameters:
      T1 - component type of the 1st List
      T2 - component type of the 2nd List
      T3 - component type of the 3rd List
      T4 - component type of the 4th List
      T5 - component type of the 5th List
      T6 - component type of the 6th List
      T7 - component type of the 7th List
      Parameters:
      ts1 - the 1st List
      ts2 - the 2nd List
      ts3 - the 3rd List
      ts4 - the 4th List
      ts5 - the 5th List
      ts6 - the 6th List
      ts7 - the 7th List
      Returns:
      a new For-comprehension of arity 7
    • For

      public 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 a For-comprehension of 8 Lists.
      Type Parameters:
      T1 - component type of the 1st List
      T2 - component type of the 2nd List
      T3 - component type of the 3rd List
      T4 - component type of the 4th List
      T5 - component type of the 5th List
      T6 - component type of the 6th List
      T7 - component type of the 7th List
      T8 - component type of the 8th List
      Parameters:
      ts1 - the 1st List
      ts2 - the 2nd List
      ts3 - the 3rd List
      ts4 - the 4th List
      ts5 - the 5th List
      ts6 - the 6th List
      ts7 - the 7th List
      ts8 - the 8th List
      Returns:
      a new For-comprehension of arity 8
    • Match

      @GwtIncompatible public static <T> API.Match<T> Match(T value)
      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, R> API.Match.Case<T,R> Case(API.Match.Pattern1<T,T1> pattern, Function<? super T1,? extends R> f)
    • Case

      @GwtIncompatible public static <T, T1, R> API.Match.Case<T,R> Case(API.Match.Pattern1<T,T1> pattern, Supplier<? extends R> supplier)
    • Case

      @GwtIncompatible public static <T, T1, R> API.Match.Case<T,R> Case(API.Match.Pattern1<T,T1> pattern, R retVal)
    • Case

      @GwtIncompatible public 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)
    • Case

      @GwtIncompatible public static <T, T1, T2, R> API.Match.Case<T,R> Case(API.Match.Pattern2<T,T1,T2> pattern, Supplier<? extends R> supplier)
    • Case

      @GwtIncompatible public static <T, T1, T2, R> API.Match.Case<T,R> Case(API.Match.Pattern2<T,T1,T2> pattern, R retVal)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, R> API.Match.Case<T,R> Case(API.Match.Pattern3<T,T1,T2,T3> pattern, Function3<? super T1,? super T2,? super T3,? extends R> f)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, R> API.Match.Case<T,R> Case(API.Match.Pattern3<T,T1,T2,T3> pattern, Supplier<? extends R> supplier)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, R> API.Match.Case<T,R> Case(API.Match.Pattern3<T,T1,T2,T3> pattern, R retVal)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, R> API.Match.Case<T,R> Case(API.Match.Pattern4<T,T1,T2,T3,T4> pattern, Function4<? super T1,? super T2,? super T3,? super T4,? extends R> f)
    • Case

      @GwtIncompatible public 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)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, R> API.Match.Case<T,R> Case(API.Match.Pattern4<T,T1,T2,T3,T4> pattern, R retVal)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, R> API.Match.Case<T,R> Case(API.Match.Pattern5<T,T1,T2,T3,T4,T5> pattern, Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> f)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, R> API.Match.Case<T,R> Case(API.Match.Pattern5<T,T1,T2,T3,T4,T5> pattern, Supplier<? extends R> supplier)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, R> API.Match.Case<T,R> Case(API.Match.Pattern5<T,T1,T2,T3,T4,T5> pattern, R retVal)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, T6, R> API.Match.Case<T,R> Case(API.Match.Pattern6<T,T1,T2,T3,T4,T5,T6> pattern, Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> f)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, T6, R> API.Match.Case<T,R> Case(API.Match.Pattern6<T,T1,T2,T3,T4,T5,T6> pattern, Supplier<? extends R> supplier)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, T6, R> API.Match.Case<T,R> Case(API.Match.Pattern6<T,T1,T2,T3,T4,T5,T6> pattern, R retVal)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, T6, T7, R> API.Match.Case<T,R> Case(API.Match.Pattern7<T,T1,T2,T3,T4,T5,T6,T7> pattern, Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> f)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, T6, T7, R> API.Match.Case<T,R> Case(API.Match.Pattern7<T,T1,T2,T3,T4,T5,T6,T7> pattern, Supplier<? extends R> supplier)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, T6, T7, R> API.Match.Case<T,R> Case(API.Match.Pattern7<T,T1,T2,T3,T4,T5,T6,T7> pattern, R retVal)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, T6, T7, T8, R> API.Match.Case<T,R> Case(API.Match.Pattern8<T,T1,T2,T3,T4,T5,T6,T7,T8> pattern, Function8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> f)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, T6, T7, T8, R> API.Match.Case<T,R> Case(API.Match.Pattern8<T,T1,T2,T3,T4,T5,T6,T7,T8> pattern, Supplier<? extends R> supplier)
    • Case

      @GwtIncompatible public static <T, T1, T2, T3, T4, T5, T6, T7, T8, R> API.Match.Case<T,R> Case(API.Match.Pattern8<T,T1,T2,T3,T4,T5,T6,T7,T8> pattern, R retVal)
    • $

      @GwtIncompatible public static <T> API.Match.Pattern0<T> $()
      Wildcard pattern, matches any value.
      Type Parameters:
      T - injected type of the underlying value
      Returns:
      a new Pattern0 instance
    • $

      @GwtIncompatible public static <T> API.Match.Pattern0<T> $(T prototype)
      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
    • $

      @GwtIncompatible public static <T> API.Match.Pattern0<T> $(Predicate<? super T> predicate)
      Guard pattern, checks if a predicate is satisfied.

      This method is intended to be used with lambdas and method references, for example:

      
       String evenOrOdd(int num) {
           return Match(num).of(
                   Case($(i -> i % 2 == 0), "even"),
                   Case($(this::isOdd), "odd")
           );
       }
      
       boolean isOdd(int i) {
           return i % 2 == 1;
       }
       
      It is also valid to pass Predicate instances:
      
       Predicate<Integer> isOdd = i -> i % 2 == 1;
      
       Match(num).of(
               Case($(i -> i % 2 == 0), "even"),
               Case($(isOdd), "odd")
       );
       
      Note: Please take care when matching Predicate instances. In general, function equality is an undecidable problem in computer science. In Vavr we are only able to check, if two functions are the same instance.

      However, this code will fail:

      
       Predicate<Integer> p = i -> true;
       Match(p).of(
           Case($(p), 1) // WRONG! It calls $(Predicate)
       );
       
      Instead we have to use Predicates.is(Object):
      
       Predicate<Integer> p = i -> true;
       Match(p).of(
           Case($(is(p)), 1) // CORRECT! It calls $(T)
       );
       
      Type Parameters:
      T - type of the prototype
      Parameters:
      predicate - the predicate that tests a given value
      Returns:
      a new Pattern0 instance