Class LambdaUtil


  • public final class LambdaUtil
    extends Object
    Utility class for lambda support.
    • Method Detail

      • getAll

        public static Object[] getAll​(Supplier<?>... suppliers)
        Converts an array of lambda expressions into an array of their evaluation results.
        Parameters:
        suppliers - an array of lambda expressions or null
        Returns:
        an array containing the results of evaluating the lambda expressions (or null if the suppliers array was null
      • get

        public static Object get​(Supplier<?> supplier)
        Returns the result of evaluating the specified function. If the supplied value is of type Message, this method returns the result of calling #getFormattedMessage on that Message.
        Parameters:
        supplier - a lambda expression or null
        Returns:
        the results of evaluating the lambda expression (or null if the supplier was null
      • get

        public static Message get​(MessageSupplier supplier)
        Returns the Message supplied by the specified function.
        Parameters:
        supplier - a lambda expression or null
        Returns:
        the Message resulting from evaluating the lambda expression (or null if the supplier was null
      • getMessage

        public static Message getMessage​(Supplier<?> supplier,
                                         MessageFactory messageFactory)
        Returns a Message, either the value supplied by the specified function, or a new Message created by the specified Factory.
        Parameters:
        supplier - a lambda expression or null
        Returns:
        the Message resulting from evaluating the lambda expression or the Message created by the factory for supplied values that are not of type Message