Package lumis.util.collections
Class Lists
- java.lang.Object
-
- lumis.util.collections.Lists
-
public abstract class Lists extends java.lang.Object
List utility methods.- Since:
- 8.1.0
- Version:
- $Revision$ $Date$
-
-
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 currentIItemFilter
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 newList
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.
-
-
-
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 newList
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 currentIItemFilter
- Parameters:
original
- original listfilter
- 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
-
-