Package org.goplanit.utils.containers
Class ContainerUtils
- java.lang.Object
-
- org.goplanit.utils.containers.ContainerUtils
-
public class ContainerUtils extends Object
Utilities for containers
-
-
Constructor Summary
Constructors Constructor Description ContainerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Collection<?>>
TwrapInUnmodifiableCollectionUnlessNull(T collection, Function<T,T> wrapInUnmodifiable)
Given the colletion and mapping to unmodifiable version of the collection check if not null and then apply the wrappingstatic <T> List<T>
wrapInUnmodifiableListUnlessNull(List<T> list)
Wrap in an unmodifiable version unless it is null, then return nullstatic <T> Set<T>
wrapInUnmodifiableSetUnlessNull(Set<T> set)
Wrap in an unmodifiable version unless it is null, then return nullstatic <T> SortedSet<T>
wrapInUnmodifiableSortedSetUnlessNull(SortedSet<T> sortedSet)
Wrap in an unmodifiable version unless it is null, then return null
-
-
-
Method Detail
-
wrapInUnmodifiableCollectionUnlessNull
public static <T extends Collection<?>> T wrapInUnmodifiableCollectionUnlessNull(T collection, Function<T,T> wrapInUnmodifiable)
Given the colletion and mapping to unmodifiable version of the collection check if not null and then apply the wrapping- Type Parameters:
T
- type of collection- Parameters:
collection
- to wrapwrapInUnmodifiable
- function to perform wrapping- Returns:
- wrapped collection
-
wrapInUnmodifiableListUnlessNull
public static <T> List<T> wrapInUnmodifiableListUnlessNull(List<T> list)
Wrap in an unmodifiable version unless it is null, then return null- Type Parameters:
T
- type of entries- Parameters:
list
- to wrap- Returns:
- wrapped list, or null
-
wrapInUnmodifiableSetUnlessNull
public static <T> Set<T> wrapInUnmodifiableSetUnlessNull(Set<T> set)
Wrap in an unmodifiable version unless it is null, then return null- Type Parameters:
T
- type of entries- Parameters:
set
- to wrap- Returns:
- wrapped set, or null
-
-