org.codeartisans.java.toolbox
Class CollectionUtils
java.lang.Object
org.codeartisans.java.toolbox.CollectionUtils
public final class CollectionUtils
- extends Object
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
firstElementOrNull
public static <T> T firstElementOrNull(Iterable<T> iterable)
collectionEquals
public static boolean collectionEquals(Collection<?> oldCollection,
Collection<?> newCollection)
- Parameters:
oldCollection - A CollectionnewCollection - Another Collection
- Returns:
- True iff both collection are null or contains the same elements, false otherwise.
removed
public static <T> Collection<T> removed(Collection<T> left,
Collection<T> right)
- Type Parameters:
T - Type of collection elements.- Parameters:
left - Left collection of query. Treated as an empty collection if null.right - Right collection of query. Treated as an empty collection if null.
- Returns:
- A collection containing elements from the left collection not present in the right collection.
added
public static <T> Collection<T> added(Collection<T> left,
Collection<T> right)
- Type Parameters:
T - Type of collection elements.- Parameters:
left - Left collection of query. Treated as an empty collection if null.right - Right collection of query. Treated as an empty collection if null.
- Returns:
- A collection containing elements from the right collection not present in the left collection.
Copyright © 2010. All Rights Reserved.