stomp.wrapper
Class CollectionHelper

java.lang.Object
  |
  +--stomp.wrapper.CollectionHelper

public class CollectionHelper
extends java.lang.Object

Utility class for working with Collections.

Author:
Eric Lindauer

Constructor Summary
CollectionHelper()
           
 
Method Summary
static CollectionDelegate createCollection(java.lang.Class collectionTemplate)
           
static CollectionDelegate createCollection(java.util.Collection collection)
           
static MapDelegate createMap(java.lang.Class mapTemplate)
           
static java.util.Map createMap(java.lang.Class mapTemplate, int capacity)
           
static java.util.Map createMap(java.lang.Class mapTemplate, int capacity, float load)
           
static MapDelegate createMap(java.util.Map map)
           
static java.util.Set createSet(java.lang.Class setClass, java.util.Comparator compare)
           
static java.lang.Object getFirst(java.util.Collection c)
          returns the first object in the collection if c is not null and has size > 0.
static java.util.List mergeSorted(java.util.List first, java.util.List second)
          merges the comparable objects in first and second into the first List.
static java.util.List sort(java.util.Collection collection)
           
static java.util.Collection toCollection(javax.jdo.Extent e)
           
static java.util.Collection toCollection(javax.jdo.Extent e, java.util.Collection startList)
           
static java.util.List toList(java.lang.Object[] objects)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionHelper

public CollectionHelper()
Method Detail

createCollection

public static CollectionDelegate createCollection(java.util.Collection collection)

createMap

public static MapDelegate createMap(java.util.Map map)

createSet

public static java.util.Set createSet(java.lang.Class setClass,
                                      java.util.Comparator compare)

createCollection

public static CollectionDelegate createCollection(java.lang.Class collectionTemplate)

createMap

public static java.util.Map createMap(java.lang.Class mapTemplate,
                                      int capacity,
                                      float load)

createMap

public static java.util.Map createMap(java.lang.Class mapTemplate,
                                      int capacity)

createMap

public static MapDelegate createMap(java.lang.Class mapTemplate)

getFirst

public static java.lang.Object getFirst(java.util.Collection c)
returns the first object in the collection if c is not null and has size > 0. Otherwise, returns null.


toCollection

public static java.util.Collection toCollection(javax.jdo.Extent e,
                                                java.util.Collection startList)

toList

public static java.util.List toList(java.lang.Object[] objects)

toCollection

public static java.util.Collection toCollection(javax.jdo.Extent e)

sort

public static java.util.List sort(java.util.Collection collection)

mergeSorted

public static java.util.List mergeSorted(java.util.List first,
                                         java.util.List second)
merges the comparable objects in first and second into the first List. Since the list is sorted, this is an O(n) algorithm.