public class SetUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SetUtils.SetHasMultipleElementsException
Exception thrown if an attempt is made to get the single element from
a set that has multiple elements.
|
Modifier and Type | Method and Description |
---|---|
static <T> T |
getSingleElement(java.util.Set<T> set)
Gets the single element of a set if it has only one element.
|
public static <T> T getSingleElement(java.util.Set<T> set) throws SetUtils.SetHasMultipleElementsException
T
- The type of the elements of the setset
- The setSetUtils.SetHasMultipleElementsException
- If the set has multiple
elements in it