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!
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static Optional | |
| private static <T extends @Nullable Object> T | |
| public static <T extends @Nullable Object> void | forEachInReverseOrder(List<T> list, Consumer<? super T> action)
Call the supplied action on each element of the supplied |
| public static <T extends @Nullable Object> Optional | Returns: the first element of the collection; empty if the collection is emptythe collection to get the element from collection)Get the first element of the supplied collection unless it's empty. |
| public static <T> T | Returns: the only element of the collectionthe collection to get the element from collection)Get the only element of a collection of size 1. |
| public static boolean | Returns: true if an instance of the type can be converted into a streamthe type to check; may be type)nullDetermine if an instance of the supplied type can be converted into a
|
| public static Stream | |
| private static Stream |
| CollectionUtils | back to summary |
|---|---|
| private CollectionUtils() | |
| findIteratorMethod | back to summary |
|---|---|
| private static Optional | |
| firstElement | back to summary |
|---|---|
| private static <T extends @Nullable Object> T firstElement(Collection<T> collection) | |
| forEachInReverseOrder | back to summary |
|---|---|
| public static <T extends @Nullable Object> void forEachInReverseOrder(List<T> list, Consumer<? super T> action) Call the supplied action on each element of the supplied | |
| getFirstElement | back to summary |
|---|---|
| public static <T extends @Nullable Object> Optional Get the first element of the supplied collection unless it's empty.
| |
| getOnlyElement | back to summary |
|---|---|
| public static <T> T getOnlyElement(Collection<T> collection) Get the only element of a collection of size 1.
| |
| isConvertibleToStream | back to summary |
|---|---|
| public static boolean isConvertibleToStream(@Nullable Class<?> type) Determine if an instance of the supplied type can be converted into a
If this method returns
| |
| toStream | back to summary |
|---|---|
| public static Stream Convert an object of one of the following supported types into a
| |
| tryConvertToStreamByReflection | back to summary |
|---|---|
| private static Stream | |