au.edu.anu.portal.portlets.basiclti.support
Class CollectionsSupport

java.lang.Object
  extended by au.edu.anu.portal.portlets.basiclti.support.CollectionsSupport

public class CollectionsSupport
extends Object

Java.util.Collections utility class. Does a few miscellaneous tasks

Author:
Steve Swinsburg (steve.swinsburg@anu.edu.au)

Constructor Summary
CollectionsSupport()
           
 
Method Summary
static void printMap(Map<?,?> map)
          Print all key-value pairs of a map to the log at debug level
static List<String> splitStringToList(String str, String delimiter)
          Split a String to a List, based on the given delimiter
static List<String> splitStringToList(String str, String delimiter, boolean chomp)
          Split a String to a List, based on the given delimiter, and also chomp any new lines that may be present.
static Map<String,String> splitStringToMap(String str, String setDelimiter, String kvDelimiter)
          Split a String to a Map, based on the given delimiters, one for the sets and one for each pair
static Map<String,String> splitStringToMap(String str, String setDelimiter, String kvDelimiter, boolean chomp)
          Split a String to a Map, based on the given delimiters, one for the sets and one for each pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionsSupport

public CollectionsSupport()
Method Detail

printMap

public static void printMap(Map<?,?> map)
Print all key-value pairs of a map to the log at debug level

Parameters:
map -

splitStringToList

public static List<String> splitStringToList(String str,
                                             String delimiter)
Split a String to a List, based on the given delimiter

Parameters:
str - the string
delimiter - delimiter to split on
Returns:

splitStringToList

public static List<String> splitStringToList(String str,
                                             String delimiter,
                                             boolean chomp)
Split a String to a List, based on the given delimiter, and also chomp any new lines that may be present.

Parameters:
str - the string
delimiter - delimiter to split on
chomp - remove new lines as well?
Returns:

splitStringToMap

public static Map<String,String> splitStringToMap(String str,
                                                  String setDelimiter,
                                                  String kvDelimiter)
Split a String to a Map, based on the given delimiters, one for the sets and one for each pair

Parameters:
str -
setDelimiter - the delimiter between each set of items
kvDelimiter - the delimiter between each item in a pair
Returns:

splitStringToMap

public static Map<String,String> splitStringToMap(String str,
                                                  String setDelimiter,
                                                  String kvDelimiter,
                                                  boolean chomp)
Split a String to a Map, based on the given delimiters, one for the sets and one for each pair. Can also chomp new lines

Parameters:
str -
setDelimiter - the delimiter between each set of items
kvDelimiter - the delimiter between each item in a pair
chomp - whether or not to chomp new lines that may separate each pair
Returns:


Copyright © 2010-2012 Division of Information, Australian National University. All Rights Reserved.