Package org.jclouds.chef.util
Class CollectionUtils
- java.lang.Object
-
- org.jclouds.chef.util.CollectionUtils
-
public class CollectionUtils extends Object
Utility methods to work with collections.
-
-
Constructor Summary
Constructors Constructor Description CollectionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <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.
-
-
-
Method Detail
-
copyOfOrEmpty
public static <T> com.google.common.collect.ImmutableList<T> copyOfOrEmpty(@Nullable List<T> input)
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
public static <T> com.google.common.collect.ImmutableSet<T> copyOfOrEmpty(@Nullable Set<T> input)
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.
-
-