|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object i3.dragos.util.CollectionHelper
public final class CollectionHelper
Helper class for retrieving a single element from a collection while ensuring in the process that the collection contains exactly one item.
Method Summary | ||
---|---|---|
static
|
getSingleElement(java.util.Collection<T> c)
Returns a single element from a Collection, does not specify the caller. |
|
static
|
getSingleElement(java.util.Collection<T> c,
java.lang.String caller)
Returns a single element from a Collection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> T getSingleElement(java.util.Collection<T> c) throws EntityNotFoundException, MultipleResultsException
T
- The type of the elements in the collection.c
- The Collection.
EntityNotFoundException
- if the Collection is emtpy.
MultipleResultsException
- if the Collection contained more than one element.public static <T> T getSingleElement(java.util.Collection<T> c, java.lang.String caller) throws EntityNotFoundException, MultipleResultsException
T
- The type of the elements in the collection.c
- The Collection.caller
- Name of calling method, used in error messages (may be null
).
EntityNotFoundException
- if the Collection is emtpy.
MultipleResultsException
- if the Collection contained more than one element.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |