public final class RMCollectionUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RMCollectionUtils.Difference
This enum represents a change in an entry between 2 collections.
|
| Modifier and Type | Method and Description |
|---|---|
static <T extends Serializable,LIST extends Serializable & List<T>> |
asSerializableList(T... elements)
Returns a Serializable List containing all of the provided elements.
|
static <T> HashSet<T> |
asSet(Collection<T> c)
Returns a Set containing all of the elements in the provided collection.
|
static <T> HashSet<T> |
asSet(T... elements)
Returns a Set containing all of the provided elements.
|
static <K,V> RMCollectionUtils.Difference |
diffKey(Map<K,V> from,
Map<K,V> to,
K key)
Determines the change in a Map entry between two Maps.
|
static <T> List<T> |
getDuplicateElements(List<T> l)
Gets the list of duplicate elements contained within the specified list, if any.
|
static <T> T |
head(List<T> l)
Returns the head (element at index 0) of the provided List.
|
static <T> List<T> |
tail(List<T> l)
Returns the tail of the provided List i.e. the sublist which contains
all elements of the given list except the
head. |
public static <T> List<T> getDuplicateElements(List<T> l)
T - the element type of the list.l - the list in which to find duplicates.public static <T> T head(List<T> l)
T - the type of the List.l - the list whose head is sought.null for the empty list.NullPointerException - if l is nullpublic static <T> List<T> tail(List<T> l)
head.T - the type of the List.l - the list whose tail is sought.NullPointerException - if l is nullUnsupportedOperationException - if the provided list was empty.@SafeVarargs public static <T extends Serializable,LIST extends Serializable & List<T>> LIST asSerializableList(T... elements)
T - the element type.elements - the elements to put in a list.@SafeVarargs public static <T> HashSet<T> asSet(T... elements)
Set contract.T - the element type.elements - the elements to put in a Set.public static <T> HashSet<T> asSet(Collection<T> c)
Set contract.T - the element type.c - the elements to put in a Set.public static <K,V> RMCollectionUtils.Difference diffKey(Map<K,V> from, Map<K,V> to, K key)
K - the type of the key.V - the type of the value.from - the first collection.to - the second collection.key - the key identifying the entry.RMCollectionUtils.Difference.IllegalArgumentException - if key is null.Copyright © 2005–2017 Alfresco Software. All rights reserved.