org.compass.core.util.backport.java.util
Class Collections

java.lang.Object
  extended by org.compass.core.util.backport.java.util.Collections

public class Collections
extends Object

Augments Collections with methods added in Java 5.0 and higher. Adds support for dynamically typesafe collection wrappers, and several utility methods.

See Also:
Collections

Method Summary
static boolean addAll(Collection c, Object[] a)
           
static Queue asLifoQueue(Deque deque)
           
static int binarySearch(List list, Object key)
           
static int binarySearch(List list, Object key, Comparator c)
           
static Collection checkedCollection(Collection c, Class type)
           
static List checkedList(List l, Class type)
           
static Map checkedMap(Map m, Class keyType, Class valueType)
           
static Set checkedSet(Set s, Class type)
           
static SortedMap checkedSortedMap(SortedMap m, Class keyType, Class valueType)
           
static SortedSet checkedSortedSet(SortedSet s, Class type)
           
static void copy(List dest, List src)
           
static boolean disjoint(Collection a, Collection b)
           
static List emptyList()
           
static Map emptyMap()
           
static Set emptySet()
           
static Enumeration enumeration(Collection c)
           
static void fill(List list, Object obj)
           
static int frequency(Collection c, Object o)
           
static int indexOfSubList(List source, List target)
           
static int lastIndexOfSubList(List source, List target)
           
static ArrayList list(Enumeration e)
           
static Object max(Collection coll)
           
static Object max(Collection coll, Comparator comp)
           
static Object min(Collection coll)
           
static Object min(Collection coll, Comparator comp)
           
static List nCopies(int n, Object o)
           
static Set newSetFromMap(Map map)
           
static boolean replaceAll(List list, Object oldVal, Object newVal)
           
static void reverse(List list)
           
static Comparator reverseOrder()
           
static Comparator reverseOrder(Comparator cmp)
           
static void rotate(List list, int distance)
           
static void shuffle(List list)
           
static void shuffle(List list, Random rnd)
           
static Set singleton(Object o)
           
static List singletonList(Object o)
           
static Map singletonMap(Object key, Object value)
           
static void sort(List list)
           
static void sort(List list, Comparator c)
           
static void swap(List list, int i, int j)
           
static Collection synchronizedCollection(Collection c)
           
static List synchronizedList(List l)
           
static Map synchronizedMap(Map m)
           
static Set synchronizedSet(Set s)
           
static SortedMap synchronizedSortedMap(SortedMap m)
           
static SortedSet synchronizedSortedSet(SortedSet s)
           
static Collection unmodifiableCollection(Collection c)
           
static List unmodifiableList(List l)
           
static Map unmodifiableMap(Map m)
           
static Set unmodifiableSet(Set s)
           
static SortedMap unmodifiableSortedMap(SortedMap m)
           
static SortedSet unmodifiableSortedSet(SortedSet s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sort

public static void sort(List list)

sort

public static void sort(List list,
                        Comparator c)

binarySearch

public static int binarySearch(List list,
                               Object key)

binarySearch

public static int binarySearch(List list,
                               Object key,
                               Comparator c)

reverse

public static void reverse(List list)

shuffle

public static void shuffle(List list)

shuffle

public static void shuffle(List list,
                           Random rnd)

swap

public static void swap(List list,
                        int i,
                        int j)

fill

public static void fill(List list,
                        Object obj)

copy

public static void copy(List dest,
                        List src)

min

public static Object min(Collection coll)

min

public static Object min(Collection coll,
                         Comparator comp)

max

public static Object max(Collection coll)

max

public static Object max(Collection coll,
                         Comparator comp)

rotate

public static void rotate(List list,
                          int distance)

replaceAll

public static boolean replaceAll(List list,
                                 Object oldVal,
                                 Object newVal)

indexOfSubList

public static int indexOfSubList(List source,
                                 List target)

lastIndexOfSubList

public static int lastIndexOfSubList(List source,
                                     List target)

unmodifiableCollection

public static Collection unmodifiableCollection(Collection c)

unmodifiableSet

public static Set unmodifiableSet(Set s)

unmodifiableSortedSet

public static SortedSet unmodifiableSortedSet(SortedSet s)

unmodifiableList

public static List unmodifiableList(List l)

unmodifiableMap

public static Map unmodifiableMap(Map m)

unmodifiableSortedMap

public static SortedMap unmodifiableSortedMap(SortedMap m)

synchronizedCollection

public static Collection synchronizedCollection(Collection c)

synchronizedSet

public static Set synchronizedSet(Set s)

synchronizedSortedSet

public static SortedSet synchronizedSortedSet(SortedSet s)

synchronizedList

public static List synchronizedList(List l)

synchronizedMap

public static Map synchronizedMap(Map m)

synchronizedSortedMap

public static SortedMap synchronizedSortedMap(SortedMap m)

checkedCollection

public static Collection checkedCollection(Collection c,
                                           Class type)

checkedSet

public static Set checkedSet(Set s,
                             Class type)

checkedSortedSet

public static SortedSet checkedSortedSet(SortedSet s,
                                         Class type)

checkedList

public static List checkedList(List l,
                               Class type)

checkedMap

public static Map checkedMap(Map m,
                             Class keyType,
                             Class valueType)

checkedSortedMap

public static SortedMap checkedSortedMap(SortedMap m,
                                         Class keyType,
                                         Class valueType)

emptySet

public static Set emptySet()

emptyList

public static List emptyList()

emptyMap

public static Map emptyMap()

singleton

public static Set singleton(Object o)

singletonList

public static List singletonList(Object o)

singletonMap

public static Map singletonMap(Object key,
                               Object value)

nCopies

public static List nCopies(int n,
                           Object o)

reverseOrder

public static Comparator reverseOrder()

reverseOrder

public static Comparator reverseOrder(Comparator cmp)

enumeration

public static Enumeration enumeration(Collection c)

list

public static ArrayList list(Enumeration e)

frequency

public static int frequency(Collection c,
                            Object o)

disjoint

public static boolean disjoint(Collection a,
                               Collection b)

addAll

public static boolean addAll(Collection c,
                             Object[] a)

newSetFromMap

public static Set newSetFromMap(Map map)

asLifoQueue

public static Queue asLifoQueue(Deque deque)


Copyright (c) 2004-2006 The Compass Project.