@API(value=Internal) public final class CollectionUtils extends Object
Collections
.
These utilities are intended solely for usage within the JUnit framework itself. Any usage by external parties is not supported. Use at your own risk!
Modifier and Type | Method and Description |
---|---|
static <T> T |
getOnlyElement(Collection<T> collection)
Read the only element of a collection of size 1.
|
public static <T> T getOnlyElement(Collection<T> collection)
collection
- the collection to get the element fromPreconditionViolationException
- if the collection is null
or does not contain exactly one element