Top Constructors Methods
liquibase.util

public Class CollectionUtil

extends Object
Class Inheritance
Imports
java.util.*

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <T> List<T>
createIfNull(List<T> currentValue)

Returns passed currentValue if it is not null and creates a new ArrayList if it is null.

public static <T> T[]
createIfNull(T[] arguments)

Returns a new empty array if the passed array is null.

public static <T> Set<T>
createIfNull(Set<T> currentValue)

Returns a new empty set if the passed set is null.

public static <T, E> Map<T, E>
createIfNull(Map<T, E> currentValue)

Returns a new empty map if the passed map is null.

public static String

Returns:

the properly cased key, if found, or null if not found
findKeyInMapIgnoreCase
(String
the key to search for, in any case
key
,
Map<String, Object>
the map in which to search
map
)

Find the actual key in a map, by searching the keys in the map and checking them ignoring case.

public static Map<String, Object>
flatten(Map<String, Object> map)

Converts a set of nested maps (like from yaml/json) into a flat map with dot-separated properties

private static Map<String, Object>
flatten(String prefix, Map<String, Object> map)

public static <T> List<Map<String, T>>
permutations(Map<String, List<T>> parameterValues)

private static <T> void
permute(Map<String, T> basePermutation, List<String> remainingKeys, Map<String, List<T>> parameterValues, List<Map<String, T>> returnList)

public static <T> Set<Set<T>>
powerSet(Collection<T> originalSet)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CollectionUtilback to summary
public CollectionUtil()

Method Detail

createIfNullback to summary
public static <T> List<T> createIfNull(List<T> currentValue)

Returns passed currentValue if it is not null and creates a new ArrayList if it is null.

Example: values = createIfNull(values)

createIfNullback to summary
public static <T> T[] createIfNull(T[] arguments)

Returns a new empty array if the passed array is null.

createIfNullback to summary
public static <T> Set<T> createIfNull(Set<T> currentValue)

Returns a new empty set if the passed set is null.

createIfNullback to summary
public static <T, E> Map<T, E> createIfNull(Map<T, E> currentValue)

Returns a new empty map if the passed map is null.

findKeyInMapIgnoreCaseback to summary
public static String findKeyInMapIgnoreCase(String key, Map<String, Object> map)

Find the actual key in a map, by searching the keys in the map and checking them ignoring case.

Parameters
key:String

the key to search for, in any case

map:Map<String, Object>

the map in which to search

Returns:String

the properly cased key, if found, or null if not found

flattenback to summary
public static Map<String, Object> flatten(Map<String, Object> map)

Converts a set of nested maps (like from yaml/json) into a flat map with dot-separated properties

flattenback to summary
private static Map<String, Object> flatten(String prefix, Map<String, Object> map)
permutationsback to summary
public static <T> List<Map<String, T>> permutations(Map<String, List<T>> parameterValues)
permuteback to summary
private static <T> void permute(Map<String, T> basePermutation, List<String> remainingKeys, Map<String, List<T>> parameterValues, List<Map<String, T>> returnList)
powerSetback to summary
public static <T> Set<Set<T>> powerSet(Collection<T> originalSet)