Class Lists


  • public abstract class Lists
    extends java.lang.Object
    List utility methods.
    Since:
    8.1.0
    Version:
    $Revision: 26587 $ $Date: 2024-08-26 21:09:17 -0300 (Mon, 26 Aug 2024) $
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <V> java.util.List<V> filter​(java.util.List<V> original, IItemFilter<V> filter)
      Returns a list filtered by the current IItemFilter
      static <V> java.util.List<V> fromCollection​(java.util.Collection<V> collection)
      Returns a list using the items in the given collection.
      static <From,​To>
      java.util.List<To>
      transform​(java.util.List<From> list, Transformer<From,​To> transformer)
      Returns a new List using the given transformer to transform the original elements into the new ones.
      static <V> java.util.List<V> unionView​(java.util.List<V>... lists)
      Returns a view of the union of the given lists to allow iterating the lists as they were only one.
      • Methods inherited from class java.lang.Object

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

      • transform

        public static <From,​To> java.util.List<To> transform​(java.util.List<From> list,
                                                                   Transformer<From,​To> transformer)
                                                            throws PortalException
        Returns a new List using the given transformer to transform the original elements into the new ones.
        Parameters:
        list - the original list.
        transformer - the transformer to be used.
        Returns:
        a new List using the given transformer to transform the original elements into the new ones.
        Throws:
        PortalException
        Since:
        8.1.0
      • fromCollection

        public static <V> java.util.List<V> fromCollection​(java.util.Collection<V> collection)
        Returns a list using the items in the given collection. The order used to create the list is arbitrary and non-deterministic.
        Parameters:
        collection - the collection of items.
        Returns:
        a list using the items in the given collection.
        Since:
        8.1.0
      • filter

        public static <V> java.util.List<V> filter​(java.util.List<V> original,
                                                   IItemFilter<V> filter)
                                            throws PortalException
        Returns a list filtered by the current IItemFilter
        Parameters:
        original - original list
        filter - filter to be applied on original list
        Returns:
        new filtered list
        Throws:
        PortalException
        Since:
        8.1.0
      • unionView

        @SafeVarargs
        public static <V> java.util.List<V> unionView​(java.util.List<V>... lists)
        Returns a view of the union of the given lists to allow iterating the lists as they were only one. This is neither thread safe nor it supports changes in the underlying lists after creation.
        Type Parameters:
        V -
        Parameters:
        lists - the lists
        Returns:
        the List that can iterate over the items of all lists.
        Since:
        17.0.0