com.is.util
Class ListUtil

java.lang.Object
  |
  +--com.is.util.ListUtil

public class ListUtil
extends java.lang.Object

This class defines a set of static methods which allow get sublists, convert to & from arrays, sort, and concatenate lists.


Constructor Summary
ListUtil()
           
 
Method Summary
static java.lang.Object find(java.util.List v, java.lang.String keyPath, java.lang.Object equals)
          Iterate through the list and return the first object whose KeyPath is equal to the "equals" argument.
static java.lang.String join(java.util.List vec, java.lang.String separator)
          Return a string that contains all the list components as strings separated by the specified separator.
static java.util.List listFromArray(java.lang.Object[] array)
          Create a list from an array of objects.
static java.util.List select(java.util.List v, java.lang.String keyPath, java.lang.Object equals)
          Iterate through the list looking for objects whose KeyPath is equal to the equals argument.
static java.util.List sort(java.util.List aList)
          Sort List argument - natural order
static java.lang.String[] stringArrayFromList(java.util.List list)
          Create an array of strings from a list of strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListUtil

public ListUtil()
Method Detail

join

public static java.lang.String join(java.util.List vec,
                                    java.lang.String separator)
Return a string that contains all the list components as strings separated by the specified separator.
Parameters:
vec - the list to convert to a separated string
separator - the string separator between elements
Returns:
a concatenated string of the list elements

listFromArray

public static java.util.List listFromArray(java.lang.Object[] array)
Create a list from an array of objects.
Parameters:
array - the array of objects to convert to a list
Returns:
a list of objects

stringArrayFromList

public static java.lang.String[] stringArrayFromList(java.util.List list)
Create an array of strings from a list of strings.
Parameters:
list - the list to convert into an array of strings
Returns:
an array of strings

sort

public static java.util.List sort(java.util.List aList)
Sort List argument - natural order
Parameters:
List - aList

find

public static java.lang.Object find(java.util.List v,
                                    java.lang.String keyPath,
                                    java.lang.Object equals)
                             throws KeyPathHelper.KeyPathException
Iterate through the list and return the first object whose KeyPath is equal to the "equals" argument. Return null if none exist.
Parameters:
v - a value of type 'List'
keyPath - a value of type 'String'
equals - a value of type 'Object'
Returns:
a value of type 'List'
See Also:
KeyPathHelper

select

public static java.util.List select(java.util.List v,
                                    java.lang.String keyPath,
                                    java.lang.Object equals)
                             throws KeyPathHelper.KeyPathException
Iterate through the list looking for objects whose KeyPath is equal to the equals argument. Return the matching objects in a list. If none are found, an empty list is returned. This is similar to the Smalltalk select: statement.
Parameters:
v - a value of type 'List'
keyPath - a value of type 'String'
equals - a value of type 'Object'
Returns:
a value of type 'List'
See Also:
KeyPathHelper