org.argouml.util
Class CollectionUtil

java.lang.Object
  extended byorg.argouml.util.CollectionUtil

public final class CollectionUtil
extends Object

Some helper methods for dealing with collections.


Constructor Summary
private CollectionUtil()
          Can't construct a utility.
 
Method Summary
static Object getFirstItem(Collection c)
          Return the first item from a collection using the most efficient method possible.
static Object getFirstItemOrNull(Collection c)
          Return the first item from a collection using the most efficient method possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionUtil

private CollectionUtil()
Can't construct a utility.

Method Detail

getFirstItem

public static Object getFirstItem(Collection c)
Return the first item from a collection using the most efficient method possible.

Parameters:
c - The Collection.
Returns:
the first element of a Collection.
Throws:
NoSuchElementException - if the collection is empty.

getFirstItemOrNull

public static Object getFirstItemOrNull(Collection c)
Return the first item from a collection using the most efficient method possible. Returns null for an empty collection.

Parameters:
c - The Collection.
Returns:
the first element of a Collection.


ArgoUML © 1996-2005ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook