Class NoOperation

java.lang.Object
xyz.ronella.trivial.functional.NoOperation

public final class NoOperation extends Object
A do nothing implementation of some functional interfaces.
Since:
2.2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T1, T2> BiConsumer<T1,T2>
    An implementation of BiConsumer that does nothing.
    static <T1, T2, R> BiFunction<T1,T2,R>
    An implementation of BiFunction that does nothing.
    static <T1, T2, R> BiFunction<T1,T2,R>
    biFunction(R output)
    An implementation of BiFunction that does nothing but produce default output.
    static <T1 extends R, T2, R>
    BiFunction<T1,T2,R>
    An implementation of BiFunction that does nothing and just return argument 1.
    static <T1, T2 extends R, R>
    BiFunction<T1,T2,R>
    An implementation of BiFunction that does nothing and just return argument 2.
    static <T1, T2> BiPredicate<T1,T2>
    An implementation of Predicate that does nothing but must have a specific boolean output.
    static <T> Consumer<T>
    An implementation of Consumer that does nothing.
    static <T, R> Function<T,R>
    An implementation of Function that does nothing.
    static <T, R> Function<T,R>
    function(R output)
    An implementation of Function that does nothing but produce default output.
    static <T extends R, R>
    Function<T,R>
    An implementation of Function that does nothing and just return what passed.
    static <T> Predicate<T>
    An implementation of Predicate that does nothing but must have a specific boolean output.
    static Sink
    An implementation of Sink that does nothing.
    static <T> Supplier<T>
    An implementation of Supplier that does nothing.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • consumer

      public static <T> Consumer<T> consumer()
      An implementation of Consumer that does nothing.
      Type Parameters:
      T - The type of the argument of the consumer.
      Returns:
      A do nothing implementation of Consumer.
    • biConsumer

      public static <T1, T2> BiConsumer<T1,T2> biConsumer()
      An implementation of BiConsumer that does nothing.
      Type Parameters:
      T1 - The type of the first argument of the BiConsumer.
      T2 - The type of the second argument of the BiConsumer.
      Returns:
      A do nothing implementation of BiConsumer.
    • sink

      public static Sink sink()
      An implementation of Sink that does nothing.
      Returns:
      A do nothing implementation of Sink.
    • supplier

      public static <T> Supplier<T> supplier()
      An implementation of Supplier that does nothing.
      Type Parameters:
      T - The type of output that the supplier will generate.
      Returns:
      Always return null.
    • predicate

      public static <T> Predicate<T> predicate(Boolean output)
      An implementation of Predicate that does nothing but must have a specific boolean output.
      Type Parameters:
      T - The type of argument that the predicate will work on.
      Parameters:
      output - The desired output of the do nothing.
      Returns:
      The value of the output parameter.
    • biPredicate

      public static <T1, T2> BiPredicate<T1,T2> biPredicate(Boolean output)
      An implementation of Predicate that does nothing but must have a specific boolean output.
      Type Parameters:
      T1 - The type of first argument that the predicate will work on.
      T2 - The type of second argument that the predicate will work on.
      Parameters:
      output - The desired output of the do nothing.
      Returns:
      The value of the output parameter.
    • function

      public static <T, R> Function<T,R> function()
      An implementation of Function that does nothing.
      Type Parameters:
      T - The type of the argument to work on.
      R - The return type.
      Returns:
      Always return null.
    • function

      public static <T, R> Function<T,R> function(R output)
      An implementation of Function that does nothing but produce default output.
      Type Parameters:
      T - The type of the argument to work on.
      R - The return type.
      Parameters:
      output - The desired output of type R.
      Returns:
      The value of the output parameter.
      Since:
      2.11.0
    • functionPassThru

      public static <T extends R, R> Function<T,R> functionPassThru()
      An implementation of Function that does nothing and just return what passed.
      Type Parameters:
      T - The type of the argument of instance of R to work on.
      R - The return type.
      Returns:
      The value of the output parameter.
      Since:
      2.11.0
    • biFunction

      public static <T1, T2, R> BiFunction<T1,T2,R> biFunction()
      An implementation of BiFunction that does nothing.
      Type Parameters:
      T1 - The type of the first argument to work on.
      T2 - The type of the second argument to work on.
      R - The return type.
      Returns:
      Always return null.
    • biFunction

      public static <T1, T2, R> BiFunction<T1,T2,R> biFunction(R output)
      An implementation of BiFunction that does nothing but produce default output.
      Type Parameters:
      T1 - The type of the first argument to work on.
      T2 - The type of the second argument to work on.
      R - The return type.*
      Parameters:
      output - The desired output of type R.
      Returns:
      The value of the output parameter.
      Since:
      2.11.0
    • biFunctionArg1PassThru

      public static <T1 extends R, T2, R> BiFunction<T1,T2,R> biFunctionArg1PassThru()
      An implementation of BiFunction that does nothing and just return argument 1.
      Type Parameters:
      T1 - The type of the first argument of instance of R to work on.
      T2 - The type of the second argument to work on.
      R - The return type.*
      Returns:
      The value of the output parameter.
      Since:
      2.11.0
    • biFunctionArg2PassThru

      public static <T1, T2 extends R, R> BiFunction<T1,T2,R> biFunctionArg2PassThru()
      An implementation of BiFunction that does nothing and just return argument 2.
      Type Parameters:
      T1 - The type of the first argument to work on.
      T2 - The type of the second argument of instance of R to work on.
      R - The return type.*
      Returns:
      The value of the output parameter.
      Since:
      2.11.0