Protege 3.5

edu.stanford.smi.protege.util
Class CollectionUtilities

java.lang.Object
  extended by edu.stanford.smi.protege.util.CollectionUtilities

public class CollectionUtilities
extends Object

Description of the class

Author:
Ray Fergerson

Field Summary
static ArrayList EMPTY_ARRAY_LIST
           
 
Constructor Summary
CollectionUtilities()
           
 
Method Summary
static
<X,Y> void
apply(Collection<? extends X> c, UnaryFunction<X,Y> function)
           
static boolean containSameItems(Collection c1, Collection c2)
           
static boolean containsAny(Collection c1, Collection c2)
          Returns true if there is any element that is common to both collections.
static
<X> Collection<X>
createCollection(X o)
           
static
<X> List<X>
createList(X o)
           
static
<X,Y> Map<X,Y>
createSmallMap()
           
static boolean equalsList(Collection<?> c1, Collection<?> c2)
           
static boolean equalsSet(Collection c1, Collection c2)
           
static
<X> X
getFirstItem(Collection<X> c)
          Returns the first item in the collection or null if the collection is empty
static
<X> X
getSoleItem(Collection<X> c)
          Returns the first item in the collection.
static
<X> Collection<X>
removeFirst(Collection<X> c)
           
static String toString(Collection collection)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ARRAY_LIST

public static final ArrayList EMPTY_ARRAY_LIST
Constructor Detail

CollectionUtilities

public CollectionUtilities()
Method Detail

containSameItems

public static boolean containSameItems(Collection c1,
                                       Collection c2)

containsAny

public static boolean containsAny(Collection c1,
                                  Collection c2)
Returns true if there is any element that is common to both collections.


createCollection

public static <X> Collection<X> createCollection(X o)

createList

public static <X> List<X> createList(X o)

createSmallMap

public static <X,Y> Map<X,Y> createSmallMap()

equalsSet

public static boolean equalsSet(Collection c1,
                                Collection c2)

equalsList

public static boolean equalsList(Collection<?> c1,
                                 Collection<?> c2)

getFirstItem

public static <X> X getFirstItem(Collection<X> c)
Returns the first item in the collection or null if the collection is empty


getSoleItem

public static <X> X getSoleItem(Collection<X> c)
Returns the first item in the collection. Throws an AssertionFailureError if there is not exactly 1 item in the collection. Use getFirstItem() to get the first item of a collection if it is possible that there is either 0 items or more than 1 item in the collection.


removeFirst

public static <X> Collection<X> removeFirst(Collection<X> c)

toString

public static String toString(Collection collection)

apply

public static <X,Y> void apply(Collection<? extends X> c,
                               UnaryFunction<X,Y> function)

Protege 3.5

Submit a bug report or feature request
Protégé is a trademark of Stanford University.
Copyright (c) 1998-2013 Stanford University.