Class Functions


  • public final class Functions
    extends java.lang.Object
    A utility class for Function functionality.
    • Field Detail

      • incOneIntFunction

        private static final IntFunction incOneIntFunction
      • incOneLongFunction

        private static final LongFunction incOneLongFunction
      • decOneIntFunction

        private static final IntFunction decOneIntFunction
      • decOneLongFunction

        private static final LongFunction decOneLongFunction
      • incOneDoubleFunction

        private static final DoubleFunction incOneDoubleFunction
      • identityDoubleFunction

        private static final DoubleFunction identityDoubleFunction
      • inverseBooleanFunction

        private static final BooleanFunction inverseBooleanFunction
      • identityBooleanFunction

        private static final BooleanFunction identityBooleanFunction
      • identityIntFunction

        private static final IntFunction identityIntFunction
      • identityLongFunction

        private static final LongFunction identityLongFunction
      • identityFunction

        private static final Function identityFunction
    • Constructor Detail

      • Functions

        private Functions()
    • Method Detail

      • identityFunction

        public static Function identityFunction()
        Returns an Function that returns its input.
        Returns:
        the identity function.
      • identityDoubleFunction

        public static DoubleFunction identityDoubleFunction()
        Returns an DoubleFunction that returns its input.
        Returns:
        the identity function.
      • incDoubleFunction

        public static DoubleFunction incDoubleFunction()
        Returns a DoubleFunction that increments the input with one.
        Returns:
        the increment function.
      • identityIntFunction

        public static IntFunction identityIntFunction()
        Returns an identity IntFunction (a function that returns its input value). The instance is cached.
        Returns:
        the identity IntFunction.
      • identityLongFunction

        public static LongFunction identityLongFunction()
        Returns an identity LongFunction (a function that returns its input value). The instance is cached.
        Returns:
        the identity LongFunction.
      • incIntFunction

        public static IntFunction incIntFunction()
        Returns an IntFunction that increments the input value by one. The instance is cached.
        Returns:
        the increment IntFunction.
      • decIntFunction

        public static IntFunction decIntFunction()
        Returns an IntFunction that decrements the input value by one. The instance is cached.
        Returns:
        the decrease IntFunction.
      • incLongFunction

        public static LongFunction incLongFunction()
        Returns a LongFunction that increments the input value by one. The instance is cached.
        Returns:
        the increment LongFunction.
      • decLongFunction

        public static LongFunction decLongFunction()
        Returns a LongFunction that decrements the input value by one. The instance is cached.
        Returns:
        the decrement LongFunction.
      • incIntFunction

        public static IntFunction incIntFunction​(int amount)
        Returns a IntFunction that increments with the given amount. For the -1, 0 and 1 a cached instance is returned. In the other cases a new instance is created.
        Parameters:
        amount - the value to increment with. A negative value does a decrement.
        Returns:
        the increment IntFunction.
      • inverseBooleanFunction

        public static BooleanFunction inverseBooleanFunction()
        Returns a BooleanFunction that inverts the argument.
        Returns:
        the function
      • identityBooleanFunction

        public static BooleanFunction identityBooleanFunction()
        Returns a BooleanFunction that returns the argument.
        Returns:
        the function.
      • incLongFunction

        public static LongFunction incLongFunction​(long amount)
        Returns a LongFunction that increments with the given amount. For the -1, 0 and 1 a cached instance is returned. In the other cases a new instance is created.
        Parameters:
        amount - the value to increment with. A negative value does a decrement.
        Returns:
        the increment LongFunction.