Class Functions


  • public final class Functions
    extends java.lang.Object
    Commonly used Function instances.
    Since:
    0.5
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Functions()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> Function<java.lang.Object,​T> returnConstant​(T constant)
      A Function that always ignores its argument and returns a constant value.
      static <T> Function<java.lang.Object,​T> returnNull()
      A Function that always ignores its argument and returns null.
      static Function<java.lang.Object,​java.lang.String> returnToString()
      A Function that always returns the Object.toString() value of the input.
      static <T> Function<java.lang.Object,​T> throwAssertionError()
      A Function that always ignores its argument and throws an AssertionError.
      static <T> Function<java.lang.Object,​T> throwIllegalArgumentException()
      A Function that always ignores its argument and throws an IllegalArgumentException.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RETURN_NULL

        private static final Function<java.lang.Object,​java.lang.Void> RETURN_NULL
      • THROW_ILLEGAL_ARGUMENT_EXCEPTION

        private static final Function<java.lang.Object,​java.lang.Void> THROW_ILLEGAL_ARGUMENT_EXCEPTION
      • THROW_ASSERTION_ERROR

        private static final Function<java.lang.Object,​java.lang.Void> THROW_ASSERTION_ERROR
      • RETURN_TO_STRING

        private static final Function<java.lang.Object,​java.lang.String> RETURN_TO_STRING
    • Constructor Detail

      • Functions

        private Functions()
    • Method Detail

      • returnNull

        public static <T> Function<java.lang.Object,​T> returnNull()
        A Function that always ignores its argument and returns null.
        Returns:
        a Function that always ignores its argument and returns null.
        Since:
        0.5
      • returnConstant

        public static <T> Function<java.lang.Object,​T> returnConstant​(T constant)
        A Function that always ignores its argument and returns a constant value.
        Returns:
        a Function that always ignores its argument and returns a constant value.
        Since:
        0.5
      • returnToString

        public static Function<java.lang.Object,​java.lang.String> returnToString()
        A Function that always returns the Object.toString() value of the input.
        Returns:
        a Function that always returns the Object.toString() value of the input.
        Since:
        0.17
      • throwIllegalArgumentException

        public static <T> Function<java.lang.Object,​T> throwIllegalArgumentException()
        A Function that always ignores its argument and throws an IllegalArgumentException.
        Returns:
        a Function that always ignores its argument and throws an IllegalArgumentException.
        Since:
        0.5
      • throwAssertionError

        public static <T> Function<java.lang.Object,​T> throwAssertionError()
        A Function that always ignores its argument and throws an AssertionError.
        Returns:
        a Function that always ignores its argument and throws an AssertionError.
        Since:
        0.6