com.ivata.mask.util
Class CollectionHandling

java.lang.Object
  extended bycom.ivata.mask.util.CollectionHandling

public final class CollectionHandling
extends java.lang.Object

This class contains extra routines for combining collection objects.

Don't create an instance of this class; use the static final methods.

Since:
ivata masks 0.4 (2002-05-16)
Version:
$Revision: 1.3 $
Author:
Colin MacLeod colin.macleod@ivata.com

Method Summary
static java.util.List convertFromLines(java.lang.String lines)
           Convert a string of strings separated by new lines into a collection of strings.
static java.util.List convertFromLines(java.lang.String lines, java.lang.String deliminators)
           Convert a string of strings separated by deliminators into a collection of strings.
static java.lang.String convertToLines(java.util.Collection convertToLines)
           Convert a collection of strings to one long string, separated by new lines.
static java.lang.String convertToLines(java.util.Collection convertToLines, char deliminator)
           Convert a collection of strings to one long string, separated by deliminators.
static void merge(java.util.Collection from, java.util.Collection to)
           Copy elements from one collection to another.
static java.util.Properties splice(java.util.Properties fromProperties, java.util.Properties toProperties)
           Creates a new properties instance which is a mixture of the two.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

convertFromLines

public static java.util.List convertFromLines(java.lang.String lines)

Convert a string of strings separated by new lines into a collection of strings.

Parameters:
lines - a single text containing many lines to be split.
Returns:
a Collection of String instances representing each line from the input.

convertFromLines

public static java.util.List convertFromLines(java.lang.String lines,
                                              java.lang.String deliminators)

Convert a string of strings separated by deliminators into a collection of strings.

Parameters:
lines - a single text containing many lines to be split.
deliminators - a String containing all possible deliminators to search for.
Returns:
a Collection of String instances representing each line from the input.

convertToLines

public static java.lang.String convertToLines(java.util.Collection convertToLines)

Convert a collection of strings to one long string, separated by new lines.

Parameters:
convertToLines - a Collection of String instances representing each line of the output.
Returns:
a single text containing the elements of the input Collection separated by new line characters.

convertToLines

public static java.lang.String convertToLines(java.util.Collection convertToLines,
                                              char deliminator)

Convert a collection of strings to one long string, separated by deliminators.

Parameters:
convertToLines - a Collection of String instances representing each line of the output.
deliminator - a char containing deliminator to add after each element.
Returns:
a single text containing the elements of the input Collection separated by new line characters.

merge

public static void merge(java.util.Collection from,
                         java.util.Collection to)

Copy elements from one collection to another. Adds all of the elements in from to those in to, if that element is not already present in to.

Parameters:
from - the collection to copy elements from
to - the collection to copy elements to. This collection will be changed and all the elements of from which can't be found will be replaced.

splice

public static java.util.Properties splice(java.util.Properties fromProperties,
                                          java.util.Properties toProperties)

Creates a new properties instance which is a mixture of the two. Adds all of the properties in fromProperties to those in toProperties, overwriting any which exist already.

Parameters:
fromProperties - the properties to base the new object on
toProperties - the properties to include if not already set
Returns:
a new Properties instance which contains all of the properties in fromProperties added to those in toProperties.


Copyright © 2001-2005 ivata limited. All Rights Reserved.