Package org.jclouds.chef.util
Class CollectionUtils
java.lang.Object
org.jclouds.chef.util.CollectionUtils
Utility methods to work with collections.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> com.google.common.collect.ImmutableList
<T> copyOfOrEmpty
(List<T> input) Creates an immutable list with the elements of the given list.static <K,
V> com.google.common.collect.ImmutableMap <K, V> copyOfOrEmpty
(Map<K, V> input) Creates an immutable map with the elements of the given map.static <T> com.google.common.collect.ImmutableSet
<T> copyOfOrEmpty
(Set<T> input) Creates an immutable set with the elements of the given set.
-
Constructor Details
-
CollectionUtils
public CollectionUtils()
-
-
Method Details
-
copyOfOrEmpty
Creates an immutable list with the elements of the given list. If the input list isnull
, it returns an empty list.- Parameters:
input
- The list used to build the immutable one.- Returns:
- An immutable list with the elements of the given list.
-
copyOfOrEmpty
Creates an immutable set with the elements of the given set. If the input set isnull
, it returns an empty set.- Parameters:
input
- The set used to build the immutable one.- Returns:
- An immutable set with the elements of the given set.
-
copyOfOrEmpty
public static <K,V> com.google.common.collect.ImmutableMap<K,V> copyOfOrEmpty(@Nullable Map<K, V> input) Creates an immutable map with the elements of the given map. If the input map isnull
, it returns an empty map.- Parameters:
input
- The map used to build the immutable one.- Returns:
- An immutable map with the elements of the given map.
-