Class CollectionUtils


  • public final class CollectionUtils
    extends Object
    Utilities for collections.
    Since:
    0.6.0
    Version:
    $Id: CollectionUtils.java 17760 2018-11-14 14:54:11Z colin $
    Author:
    tlerios@marketcetera.com
    • Constructor Detail

      • CollectionUtils

        private CollectionUtils()
        Constructor. It is private so that no instances can be created.
    • Method Detail

      • getLastNonNull

        public static <E> E getLastNonNull​(List<E> l)
        Returns the last non-null element in the given list; or, if there is no non-null element, it returns null.
        Type Parameters:
        E - the element
        Parameters:
        l - The list. It may be null, in which case null is returned.
        Returns:
        The element.
      • toArray

        public static int[] toArray​(List<Integer> l)
        Returns the non-null integers in the given list as an array.
        Parameters:
        l - The list. It may be null, in which case null is returned.
        Returns:
        The array.