Protege 2.1

edu.stanford.smi.protege.util
Class CollectionUtilities

java.lang.Object
  extended byedu.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 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 Collection createCollection(Object o)
           
static List createList(Object o)
           
static Map createSmallMap()
           
static boolean equalsList(Collection c1, Collection c2)
           
static boolean equalsSet(Collection c1, Collection c2)
           
static Object getFirstItem(Collection c)
          Returns the first item in the collection or null if the collection is empty
static Object getSoleItem(Collection c)
          Returns the first item in the collection.
static Collection removeFirst(Collection 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 Collection createCollection(Object o)

createList

public static List createList(Object o)

createSmallMap

public static Map createSmallMap()

equalsSet

public static boolean equalsSet(Collection c1,
                                Collection c2)

equalsList

public static boolean equalsList(Collection c1,
                                 Collection c2)

getFirstItem

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


getSoleItem

public static Object getSoleItem(Collection 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 Collection removeFirst(Collection c)

toString

public static String toString(Collection collection)

Protege 2.1

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