java.util
Class Collections
java.lang.Object
java.util.Collections
public class Collections
- extends Object
|
Method Summary |
static
|
addAll(Collection<? super T> c,
T... a)
|
static
|
binarySearch(List<? extends Comparable<? super T>> list,
T key)
|
static
|
binarySearch(List<? extends T> list,
T key,
Comparator<? super T> c)
|
static
|
checkedCollection(Collection<E> c,
Class<E> type)
|
static
|
checkedList(List<E> list,
Class<E> type)
|
static
|
checkedMap(Map<K,V> m,
Class<K> keyType,
Class<V> valueType)
|
static
|
checkedSet(Set<E> s,
Class<E> type)
|
static
|
checkedSortedMap(SortedMap<K,V> m,
Class<K> keyType,
Class<V> valueType)
|
static
|
checkedSortedSet(SortedSet<E> s,
Class<E> type)
|
static
|
copy(List<? super T> dest,
List<? extends T> src)
|
static boolean |
disjoint(Collection<?> c1,
Collection<?> c2)
|
static
|
emptyList()
|
static
|
emptyMap()
|
static
|
emptySet()
|
static
|
enumeration(Collection<T> c)
|
static
|
fill(List<? super T> list,
T obj)
|
static int |
frequency(Collection<?> c,
Object o)
|
static int |
indexOfSubList(List<?> source,
List<?> target)
|
static int |
lastIndexOfSubList(List<?> source,
List<?> target)
|
static
|
list(Enumeration<T> e)
|
static
|
max(Collection<? extends T> coll)
|
static
|
max(Collection<? extends T> coll,
Comparator<? super T> comp)
|
static
|
min(Collection<? extends T> coll)
|
static
|
min(Collection<? extends T> coll,
Comparator<? super T> comp)
|
static
|
nCopies(int n,
T o)
|
static
|
replaceAll(List<T> list,
T oldVal,
T newVal)
|
static void |
reverse(List<?> list)
|
static
|
reverseOrder()
|
static
|
reverseOrder(Comparator<T> cmp)
|
static void |
rotate(List<?> list,
int distance)
|
static void |
shuffle(List<?> list)
|
static void |
shuffle(List<?> list,
Random rnd)
|
static
|
singleton(T o)
|
static
|
singletonList(T o)
|
static
|
singletonMap(K key,
V value)
|
static
|
sort(List<T> list)
|
static
|
sort(List<T> list,
Comparator<? super T> c)
|
static void |
swap(List<?> list,
int i,
int j)
|
static
|
synchronizedCollection(Collection<T> c)
|
static
|
synchronizedList(List<T> list)
|
static
|
synchronizedMap(Map<K,V> m)
|
static
|
synchronizedSet(Set<T> s)
|
static
|
synchronizedSortedMap(SortedMap<K,V> m)
|
static
|
synchronizedSortedSet(SortedSet<T> s)
|
static
|
unmodifiableCollection(Collection<T> c)
|
static
|
unmodifiableList(List<T> list)
|
static
|
unmodifiableMap(Map<K,V> m)
|
static
|
unmodifiableSet(Set<T> s)
|
static
|
unmodifiableSortedMap(SortedMap<K,V> m)
|
static
|
unmodifiableSortedSet(SortedSet<T> s)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EMPTY_LIST
public static final List EMPTY_LIST
EMPTY_MAP
public static final Map EMPTY_MAP
EMPTY_SET
public static final Set EMPTY_SET
binarySearch
public static <T> int binarySearch(List<? extends Comparable<? super T>> list,
T key)
binarySearch
public static <T> int binarySearch(List<? extends T> list,
T key,
Comparator<? super T> c)
copy
public static <T> void copy(List<? super T> dest,
List<? extends T> src)
enumeration
public static <T> Enumeration<T> enumeration(Collection<T> c)
fill
public static <T> void fill(List<? super T> list,
T obj)
indexOfSubList
public static int indexOfSubList(List<?> source,
List<?> target)
lastIndexOfSubList
public static int lastIndexOfSubList(List<?> source,
List<?> target)
list
public static <T> ArrayList<T> list(Enumeration<T> e)
max
public static <T extends Object & Comparable<? super T>> T max(Collection<? extends T> coll)
max
public static <T> T max(Collection<? extends T> coll,
Comparator<? super T> comp)
min
public static <T extends Object & Comparable<? super T>> T min(Collection<? extends T> coll)
min
public static <T> T min(Collection<? extends T> coll,
Comparator<? super T> comp)
nCopies
public static <T> List<T> nCopies(int n,
T o)
replaceAll
public static <T> boolean replaceAll(List<T> list,
T oldVal,
T newVal)
reverse
public static void reverse(List<?> list)
reverseOrder
public static <T> Comparator<T> reverseOrder()
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 <T> Set<T> singleton(T o)
singletonList
public static <T> List<T> singletonList(T o)
singletonMap
public static <K,V> Map<K,V> singletonMap(K key,
V value)
sort
public static <T extends Comparable<? super T>> void sort(List<T> list)
sort
public static <T> void sort(List<T> list,
Comparator<? super T> c)
swap
public static void swap(List<?> list,
int i,
int j)
synchronizedCollection
public static <T> Collection<T> synchronizedCollection(Collection<T> c)
synchronizedList
public static <T> List<T> synchronizedList(List<T> list)
synchronizedMap
public static <K,V> Map<K,V> synchronizedMap(Map<K,V> m)
synchronizedSet
public static <T> Set<T> synchronizedSet(Set<T> s)
synchronizedSortedMap
public static <K,V> SortedMap<K,V> synchronizedSortedMap(SortedMap<K,V> m)
synchronizedSortedSet
public static <T> SortedSet<T> synchronizedSortedSet(SortedSet<T> s)
unmodifiableCollection
public static <T> Collection<T> unmodifiableCollection(Collection<T> c)
unmodifiableList
public static <T> List<T> unmodifiableList(List<T> list)
unmodifiableMap
public static <K,V> Map<K,V> unmodifiableMap(Map<K,V> m)
unmodifiableSet
public static <T> Set<T> unmodifiableSet(Set<T> s)
unmodifiableSortedMap
public static <K,V> SortedMap<K,V> unmodifiableSortedMap(SortedMap<K,V> m)
unmodifiableSortedSet
public static <T> SortedSet<T> unmodifiableSortedSet(SortedSet<T> s)
checkedCollection
public static <E> Collection<E> checkedCollection(Collection<E> c,
Class<E> type)
checkedSet
public static <E> Set<E> checkedSet(Set<E> s,
Class<E> type)
checkedSortedSet
public static <E> SortedSet<E> checkedSortedSet(SortedSet<E> s,
Class<E> type)
checkedList
public static <E> List<E> checkedList(List<E> list,
Class<E> type)
checkedMap
public static <K,V> Map<K,V> checkedMap(Map<K,V> m,
Class<K> keyType,
Class<V> valueType)
checkedSortedMap
public static <K,V> SortedMap<K,V> checkedSortedMap(SortedMap<K,V> m,
Class<K> keyType,
Class<V> valueType)
emptySet
public static final <T> Set<T> emptySet()
emptyList
public static final <T> List<T> emptyList()
emptyMap
public static final <K,V> Map<K,V> emptyMap()
reverseOrder
public static <T> Comparator<T> reverseOrder(Comparator<T> cmp)
frequency
public static int frequency(Collection<?> c,
Object o)
disjoint
public static boolean disjoint(Collection<?> c1,
Collection<?> c2)
addAll
public static <T> boolean addAll(Collection<? super T> c,
T... a)