org.codeartisans.java.toolbox
Class CollectionUtils

java.lang.Object
  extended by org.codeartisans.java.toolbox.CollectionUtils

public final class CollectionUtils
extends Object


Method Summary
static
<T> Collection<T>
added(Collection<T> left, Collection<T> right)
           
static boolean collectionEquals(Collection<?> oldCollection, Collection<?> newCollection)
           
static
<T> T
firstElementOrNull(Iterable<T> iterable)
           
static
<T> Collection<T>
removed(Collection<T> left, Collection<T> right)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

firstElementOrNull

public static <T> T firstElementOrNull(Iterable<T> iterable)

collectionEquals

public static boolean collectionEquals(Collection<?> oldCollection,
                                       Collection<?> newCollection)
Parameters:
oldCollection - A Collection
newCollection - 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.