Package com.totvs.tjf.core.common
Class CollectionUtils
- java.lang.Object
-
- com.totvs.tjf.core.common.CollectionUtils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> List<T>arrayListNullabeSafe(List<T> list)Null safe implementation for aArrayList.static <T> Set<T>hashSetNullableSafe(Set<T> set)Null safe implementation for aHashSet.static <T> Collection<T>unmodifiable(Collection<T> collection)Null safe implementation forunmodifiableCollection.static <T> List<T>unmodifiable(List<T> collection)Null safe implementation forunmodifiableList.static <K,V>
Map<K,V>unmodifiable(Map<K,V> map)Null safe implementation forunmodifiableMap.static <T> Set<T>unmodifiable(Set<T> collection)Null safe implementation forunmodifiableSet.static <T> List<T>unmodifiable(T[] array)Null safe implementation forunmodifiableList.
-
-
-
Method Detail
-
unmodifiable
public static <T> Collection<T> unmodifiable(Collection<T> collection)
Null safe implementation forunmodifiableCollection.- Parameters:
collection- for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified collection
- See Also:
Collections.emptyList(),Collections.unmodifiableCollection(java.util.Collection<? extends T>)
-
unmodifiable
public static <T> List<T> unmodifiable(List<T> collection)
Null safe implementation forunmodifiableList.- Parameters:
collection- the list for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified list
- See Also:
Collections.emptyList(),Collections.unmodifiableList(java.util.List<? extends T>)
-
unmodifiable
public static <T> Set<T> unmodifiable(Set<T> collection)
Null safe implementation forunmodifiableSet.- Parameters:
collection- the set for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified set
- See Also:
Collections.emptySet(),Collections.unmodifiableSet(java.util.Set<? extends T>)
-
unmodifiable
public static <K,V> Map<K,V> unmodifiable(Map<K,V> map)
Null safe implementation forunmodifiableMap.- Parameters:
map- the map for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified map
- See Also:
Collections.emptyMap(),Collections.unmodifiableMap(java.util.Map<? extends K, ? extends V>)
-
unmodifiable
public static <T> List<T> unmodifiable(T[] array)
Null safe implementation forunmodifiableList.- Parameters:
array- for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified list
- See Also:
Collections.emptyList(),Collections.unmodifiableList(java.util.List<? extends T>)
-
arrayListNullabeSafe
public static <T> List<T> arrayListNullabeSafe(List<T> list)
Null safe implementation for aArrayList.- Type Parameters:
T- list type- Parameters:
list- list that will be verified- Returns:
- a new
ArrayListif the list is null
-
-