Class CollectionUtil


  • public class CollectionUtil
    extends Object
    Utilities for processing Collections.
    Version:
    1.7
    • Constructor Detail

      • CollectionUtil

        public CollectionUtil()
    • Method Detail

      • transform

        public static List transform​(Collection coll,
                                     CollectionUtil.Function func)
        Executes a function on each item in a Collection and returns the results in a new List
        Parameters:
        coll - the collection to process
        func - the Function to execute
        Returns:
        a list of the transformed objects
      • apply

        public static void apply​(Collection coll,
                                 CollectionUtil.Function func)
        Executes a function on each item in a Collection but does not accumulate the result
        Parameters:
        coll - the collection to process
        func - the Function to execute
      • select

        public static List select​(Collection collection,
                                  CollectionUtil.Function func)
        Executes a CollectionUtil.Function on each item in a Collection and collects all the entries for which the result of the function is equal to Boolean true.
        Parameters:
        collection - the collection to process
        func - the Function to execute
        Returns:
        a list of objects for which the function was true