org.jclouds.chef.util
Class CollectionUtils

java.lang.Object
  extended by org.jclouds.chef.util.CollectionUtils

public class CollectionUtils
extends Object

Utility methods to work with collections.


Constructor Summary
CollectionUtils()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionUtils

public CollectionUtils()
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 is null, 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 is null, 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 is null, 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.


Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.