ProgramixGenericLib v4.0.0

com.programix.collections
Class CollectionsTools

java.lang.Object
  extended by com.programix.collections.CollectionsTools

public class CollectionsTools
extends Object

Utility methods for working with the Collections API. Unless otherwise stated, these methods are not thread-safe.

Author:
Paul Hyde
See Also:
ReverseComparator, ComparableComparator, NullFirstComparator, NullLastComparator

Field Summary
static Comparator NULL_FIRST_COMPARABLE_ASC
          This Comparator sorts Comparable objects in their normal ordering, but with any null's that may be present sorted to the top.
static Comparator NULL_FIRST_COMPARABLE_DESC
          This Comparator sorts Comparable objects in their reverse ordering, but with any null's that may be present sorted to the top.
static Comparator NULL_LAST_COMPARABLE_ASC
          This Comparator sorts Comparable objects in their normal ordering, but with any null's that may be present sorted to the bottom.
static Comparator NULL_LAST_COMPARABLE_DESC
          This Comparator sorts Comparable objects in their reverse ordering, but with any null's that may be present sorted to the bottom.
 
Method Summary
static boolean isEmpty(Collection collection)
          Returns true if the passed reference is null or if the size of the collection is 0.
static boolean isNotEmpty(Collection collection)
          Returns true if the passed reference is not null and the size of the collection greater than 0.
static char[] toCharArray(Collection charList)
          Converts a Collection holding instances of Character into a char[].
static int[] toIntArray(Collection integerList)
          Converts a collection of Number to an int[].
static String[] toStringArray(Collection strings)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_FIRST_COMPARABLE_ASC

public static final Comparator NULL_FIRST_COMPARABLE_ASC
This Comparator sorts Comparable objects in their normal ordering, but with any null's that may be present sorted to the top.

See Also:
NullFirstComparator, NullLastComparator, ReverseComparator, ComparableComparator

NULL_FIRST_COMPARABLE_DESC

public static final Comparator NULL_FIRST_COMPARABLE_DESC
This Comparator sorts Comparable objects in their reverse ordering, but with any null's that may be present sorted to the top.

See Also:
NullFirstComparator, NullLastComparator, ReverseComparator, ComparableComparator

NULL_LAST_COMPARABLE_ASC

public static final Comparator NULL_LAST_COMPARABLE_ASC
This Comparator sorts Comparable objects in their normal ordering, but with any null's that may be present sorted to the bottom.

See Also:
NullFirstComparator, NullLastComparator, ReverseComparator, ComparableComparator

NULL_LAST_COMPARABLE_DESC

public static final Comparator NULL_LAST_COMPARABLE_DESC
This Comparator sorts Comparable objects in their reverse ordering, but with any null's that may be present sorted to the bottom.

See Also:
NullFirstComparator, NullLastComparator, ReverseComparator, ComparableComparator
Method Detail

toStringArray

public static String[] toStringArray(Collection strings)

toIntArray

public static int[] toIntArray(Collection integerList)
Converts a collection of Number to an int[].


toCharArray

public static char[] toCharArray(Collection charList)
Converts a Collection holding instances of Character into a char[].


isEmpty

public static boolean isEmpty(Collection collection)
Returns true if the passed reference is null or if the size of the collection is 0.


isNotEmpty

public static boolean isNotEmpty(Collection collection)
Returns true if the passed reference is not null and the size of the collection greater than 0.


ProgramixGenericLib v4.0.0

Copyright © 2001-2007 Programix Incorporated. All rights reserved. ProgramixGenericLib is free and is OSI Certified Open Source Software under the BSD license.