biweekly.util
Class StringUtils

java.lang.Object
  extended by biweekly.util.StringUtils

public class StringUtils
extends Object

Contains miscellaneous string utilities.

Author:
Michael Angstadt

Nested Class Summary
static interface StringUtils.JoinCallback<T>
          Callback interface used with the join(Collection, String, JoinCallback) method.
static interface StringUtils.JoinMapCallback<K,V>
          Callback interface used with the join(Map, String, JoinMapCallback) method.
 
Constructor Summary
StringUtils()
           
 
Method Summary
static String join(Collection<String> collection, String delimiter)
          Joins a collection of strings into a delimited list.
static
<T> String
join(Collection<T> collection, String delimiter, StringUtils.JoinCallback<T> join)
          Joins a collection of values into a delimited list.
static
<K,V> String
join(Map<K,V> map, String delimiter, StringUtils.JoinMapCallback<K,V> join)
          Joins a map into a delimited list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtils

public StringUtils()
Method Detail

join

public static String join(Collection<String> collection,
                          String delimiter)
Joins a collection of strings into a delimited list.

Parameters:
collection - the collection of strings
delimiter - the delimiter (e.g. ",")
Returns:
the final string

join

public static <T> String join(Collection<T> collection,
                              String delimiter,
                              StringUtils.JoinCallback<T> join)
Joins a collection of values into a delimited list.

Parameters:
collection - the collection of values
delimiter - the delimiter (e.g. ",")
join - callback function to call on every element in the collection
Returns:
the final string

join

public static <K,V> String join(Map<K,V> map,
                                String delimiter,
                                StringUtils.JoinMapCallback<K,V> join)
Joins a map into a delimited list.

Parameters:
map - the map
delimiter - the delimiter (e.g. ",")
join - callback function to call on every element in the collection
Returns:
the final string


Copyright © 2013 Michael Angstadt. All Rights Reserved.