edu.emory.mathcs.backport.java.util

Class Collections


public class Collections
extends java.lang.Object

Augments java.util.Collections with methods added in Java 5.0 and higher. Adds support for dynamically typesafe collection wrappers, and several utility methods.
See Also:
java.util.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)

Method Details

addAll

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

asLifoQueue

public static Queue asLifoQueue(Deque deque)

binarySearch

public static int binarySearch(List list,
                               Object key)

binarySearch

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

checkedCollection

public static Collection checkedCollection(Collection c,
                                           Class type)

checkedList

public static List checkedList(List l,
                               Class type)

checkedMap

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

checkedSet

public static Set checkedSet(Set s,
                             Class type)

checkedSortedMap

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

checkedSortedSet

public static SortedSet checkedSortedSet(SortedSet s,
                                         Class type)

copy

public static void copy(List dest,
                        List src)

disjoint

public static boolean disjoint(Collection a,
                               Collection b)

emptyList

public static List emptyList()

emptyMap

public static Map emptyMap()

emptySet

public static Set emptySet()

enumeration

public static Enumeration enumeration(Collection c)

fill

public static void fill(List list,
                        Object obj)

frequency

public static int frequency(Collection c,
                            Object o)

indexOfSubList

public static int indexOfSubList(List source,
                                 List target)

lastIndexOfSubList

public static int lastIndexOfSubList(List source,
                                     List target)

list

public static ArrayList list(Enumeration e)

max

public static Object max(Collection coll)

max

public static Object max(Collection coll,
                         Comparator comp)

min

public static Object min(Collection coll)

min

public static Object min(Collection coll,
                         Comparator comp)

nCopies

public static List nCopies(int n,
                           Object o)

newSetFromMap

public static Set newSetFromMap(Map map)

replaceAll

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

reverse

public static void reverse(List list)

reverseOrder

public static Comparator reverseOrder()

reverseOrder

public static Comparator reverseOrder(Comparator cmp)

rotate

public static void rotate(List list,
                          int distance)

shuffle

public static void shuffle(List list)

shuffle

public static void shuffle(List list,
                           Random rnd)

singleton

public static Set singleton(Object o)

singletonList

public static List singletonList(Object o)

singletonMap

public static Map singletonMap(Object key,
                               Object value)

sort

public static void sort(List list)

sort

public static void sort(List list,
                        Comparator c)

swap

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

synchronizedCollection

public static Collection synchronizedCollection(Collection c)

synchronizedList

public static List synchronizedList(List l)

synchronizedMap

public static Map synchronizedMap(Map m)

synchronizedSet

public static Set synchronizedSet(Set s)

synchronizedSortedMap

public static SortedMap synchronizedSortedMap(SortedMap m)

synchronizedSortedSet

public static SortedSet synchronizedSortedSet(SortedSet s)

unmodifiableCollection

public static Collection unmodifiableCollection(Collection c)

unmodifiableList

public static List unmodifiableList(List l)

unmodifiableMap

public static Map unmodifiableMap(Map m)

unmodifiableSet

public static Set unmodifiableSet(Set s)

unmodifiableSortedMap

public static SortedMap unmodifiableSortedMap(SortedMap m)

unmodifiableSortedSet

public static SortedSet unmodifiableSortedSet(SortedSet s)