Package com.sun.identity.shared.test
Class CollectionUtils
- java.lang.Object
-
- com.sun.identity.shared.test.CollectionUtils
-
public class CollectionUtils extends Object
This class provides collections related helper methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,Set<String>>cloneMap(Map<String,Set<String>> map)Returns a cloned Map of String to Set of String.static Map<String,Set<String>>getEmptyValuesMap(Set<String> keys)Returns a Map of String to empty set.static Map<String,Set<String>>parseStringToMap(String str)Returns a map of String to Set of String from a formatted string.static Set<String>parseStringToSet(String str)Returns a Set of String from a formatted string.static Set<String>putSetIntoMap(String key, Map<String,Set<String>> map, String value)Returns set of string.
-
-
-
Method Detail
-
putSetIntoMap
public static Set<String> putSetIntoMap(String key, Map<String,Set<String>> map, String value)
Returns set of string. This is a convenient method for adding a set of string into a map. In this project, we usually have theMap<String, Set<String>> and many times, we just want to add a string to the map.- Parameters:
key- Key to the entry in the map.map- Map of String to Set of String.value- Value to be added to the map referenced bykey.- Returns:
- Set of string.
-
parseStringToMap
public static Map<String,Set<String>> parseStringToMap(String str)
Returns a map of String to Set of String from a formatted string. The format is<key1>=<value11>,<value12>...,<value13>; <key2>=<value21>,<value22>...,<value23>; ... <keyn>=<valuen1>,<valuen2>...,<valuen3>
- Parameters:
str- Formatted String.- Returns:
- a map of String to Set of String
-
parseStringToSet
public static Set<String> parseStringToSet(String str)
Returns a Set of String from a formatted string. The format is<value1>,<value2>...,<value3>
- Parameters:
str- Formatted String.- Returns:
- a map of String to Set of String
-
cloneMap
public static Map<String,Set<String>> cloneMap(Map<String,Set<String>> map)
Returns a cloned Map of String to Set of String.- Parameters:
map- Map to be cloned.- Returns:
- cloned map.
-
-