/** * Sends the string representations of this to the standard error stream {@linkplain System#err}. * If this value consists of multiple elements, each element is displayed in a new line. * * @throws IllegalStateException if {@code PrintStream.checkError()} is true after writing to stderr. */ @GwtIncompatible("java.io.PrintStream is not implemented") default void stderr() { out(System.err); }
/** * Entry point of the match API. * * @param value a value to be matched * @param <T> type of the value * @return a new {@code Match} instance */ @GwtIncompatible public static <T> Match<T> Match(T value) { return new Match<>(value); }
/** * Wildcard pattern, matches any value. * * @param <T> injected type of the underlying value * @return a new {@code Pattern0} instance */ @GwtIncompatible public static <T> Pattern0<T> $() { return Pattern0.any(); }
/** * Returns an unchecked function that will <em>sneaky throw</em> if an exceptions occurs when applying the function. * * @return a new Function5 that throws a {@code Throwable}. */ default Function5<T1, T2, T3, T4, T5, R> unchecked() { return (t1, t2, t3, t4, t5) -> { try { return apply(t1, t2, t3, t4, t5); } catch(Throwable t) { return sneakyThrow(t); } }; }
/** * Returns an unchecked function that will <em>sneaky throw</em> if an exceptions occurs when applying the function. * * @return a new Function4 that throws a {@code Throwable}. */ default Function4<T1, T2, T3, T4, R> unchecked() { return (t1, t2, t3, t4) -> { try { return apply(t1, t2, t3, t4); } catch(Throwable t) { return sneakyThrow(t); } }; }
/** * Returns an unchecked function that will <em>sneaky throw</em> if an exceptions occurs when applying the function. * * @return a new Function7 that throws a {@code Throwable}. */ default Function7<T1, T2, T3, T4, T5, T6, T7, R> unchecked() { return (t1, t2, t3, t4, t5, t6, t7) -> { try { return apply(t1, t2, t3, t4, t5, t6, t7); } catch(Throwable t) { return sneakyThrow(t); } }; }
/** * Returns an unchecked function that will <em>sneaky throw</em> if an exceptions occurs when applying the function. * * @return a new Function2 that throws a {@code Throwable}. */ default Function2<T1, T2, R> unchecked() { return (t1, t2) -> { try { return apply(t1, t2); } catch(Throwable t) { return sneakyThrow(t); } }; }
/** * Applies this function partially to two arguments. * * @param t1 argument 1 * @param t2 argument 2 * @return a partial application of this function */ default CheckedFunction1<T3, R> apply(T1 t1, T2 t2) { return (T3 t3) -> apply(t1, t2, t3); }
/** * Applies this function partially to two arguments. * * @param t1 argument 1 * @param t2 argument 2 * @return a partial application of this function */ default CheckedFunction2<T3, T4, R> apply(T1 t1, T2 t2) { return (T3 t3, T4 t4) -> apply(t1, t2, t3, t4); }
/** * Returns a curried version of this function. * * @return a curried function equivalent to this. */ default Function1<T1, CheckedFunction1<T2, R>> curried() { return t1 -> t2 -> apply(t1, t2); }
@Override public boolean isDefinedAt(T obj) { return pattern.isDefinedAt(obj); } }
/** * Returns a curried version of this function. * * @return a curried function equivalent to this. */ default Function1<T1, Function1<T2, CheckedFunction1<T3, R>>> curried() { return t1 -> t2 -> t3 -> apply(t1, t2, t3); }
/** * Sends the string representations of this to the standard output stream {@linkplain System#out}. * If this value consists of multiple elements, each element is displayed in a new line. * * @throws IllegalStateException if {@code PrintStream.checkError()} is true after writing to stdout. */ @GwtIncompatible("java.io.PrintStream is not implemented") default void stdout() { out(System.out); }