|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.adfnmc.java.util.Collections
public class Collections
Field Summary | |
---|---|
static java.lang.Class |
CLASS_INSTANCE
|
static List |
EMPTY_LIST
|
static Map |
EMPTY_MAP
|
static Set |
EMPTY_SET
|
Method Summary | |
---|---|
static boolean |
addAll(Collection c,
java.lang.Object[] a)
Adds all the specified elements to the specified collection |
static int |
binarySearch(List list,
java.lang.Object object)
Performs a binary search for the specified element in the specified sorted List. |
static int |
binarySearch(List list,
java.lang.Object object,
Comparator comparator)
Performs a binary search for the specified element in the specified sorted List using the specified Comparator. |
static Collection |
checkedCollection(Collection c,
java.lang.Class type)
Returns a dynamically typesafe view of the specified collection. |
static List |
checkedList(List list,
java.lang.Class type)
Returns a dynamically typesafe view of the specified list. |
static Map |
checkedMap(Map m,
java.lang.Class keyType,
java.lang.Class valueType)
Returns a dynamically typesafe view of the specified map. |
static Set |
checkedSet(Set s,
java.lang.Class type)
Returns a dynamically typesafe view of the specified set. |
static SortedMap |
checkedSortedMap(SortedMap m,
java.lang.Class keyType,
java.lang.Class valueType)
Returns a dynamically typesafe view of the specified sorted map. |
static SortedSet |
checkedSortedSet(SortedSet s,
java.lang.Class type)
Returns a dynamically typesafe view of the specified sorted set. |
static void |
copy(List destination,
List source)
Copies the elements from the source list to the destination list. |
static boolean |
disjoint(Collection c1,
Collection c2)
Returns true if the collections have no elements in common |
static List |
emptyList()
Returns a type-safe empty, immutable List . |
static Map |
emptyMap()
Returns a type-safe empty, immutable Map . |
static Set |
emptySet()
Returns a type-safe empty, immutable Set . |
static java.util.Enumeration |
enumeration(Collection collection)
Answers an Enumeration on the specified Collection. |
static void |
fill(List list,
java.lang.Object object)
Fills the specified List with the specified element. |
static int |
frequency(Collection c,
java.lang.Object o)
Returns the number of elements in the Collection that match the Object passed. |
static int |
indexOfSubList(List list,
List sublist)
Searches the list for sublist and answers the beginning index of the first occurrence. |
static int |
lastIndexOfSubList(List list,
List sublist)
Searches the list for sublist and answers the beginning index of the last occurrence. |
static ArrayList |
list(java.util.Enumeration enumeration)
Answers an ArrayList with all the elements in the enumeration . |
static java.lang.Object |
max(Collection collection)
Searches the specified Collection for the maximum element. |
static java.lang.Object |
max(Collection collection,
Comparator comparator)
Searches the specified Collection for the maximum element using the specified Comparator. |
static java.lang.Object |
min(Collection collection)
Searches the specified Collection for the minimum element. |
static java.lang.Object |
min(Collection collection,
Comparator comparator)
Searches the specified Collection for the minimum element using the specified Comparator. |
static List |
nCopies(int length,
java.lang.Object object)
Answers a List containing the specified number of the specified element. |
static void |
putAll(Hashtable source,
java.util.Hashtable dest)
|
static void |
putAll(java.util.Hashtable source,
Hashtable dest)
|
static boolean |
replaceAll(List list,
java.lang.Object obj,
java.lang.Object obj2)
Replaces all occurrences of Object obj in list with newObj . |
static void |
reverse(List list)
Returns the supplied List with the order of its contained elements reversed. |
static Comparator |
reverseOrder()
A Comparator which reverses the natural order of the elements. |
static Comparator |
reverseOrder(Comparator c)
Returns a Comparator that reverses the order of the Comparator passed. |
static void |
rotate(List lst,
int dist)
Rotates the elements in List list by the distance dist |
static void |
shuffle(List list)
Moves every element of the List to a random new position in the list. |
static void |
shuffle(List list,
java.util.Random random)
Moves every element of the List to a random new position in the list using the specified random number generator. |
static Set |
singleton(java.lang.Object object)
Answers a Set containing the specified element. |
static List |
singletonList(java.lang.Object object)
Answers a List containing the specified element. |
static Map |
singletonMap(java.lang.Object key,
java.lang.Object value)
Answers a Map containing the specified key and value. |
static void |
sort(List list)
Sorts the specified List in ascending order. |
static void |
sort(List list,
Comparator comparator)
Sorts the specified List using the specified Comparator. |
static void |
swap(List list,
int index1,
int index2)
Swaps the elements of List list at indices index1 and index2 |
static Collection |
synchronizedCollection(Collection collection)
Answers a wrapper on the specified Collection which synchronizes all access to the Collection. |
static List |
synchronizedList(List list)
Answers a wrapper on the specified List which synchronizes all access to the List. |
static Map |
synchronizedMap(Map map)
Answers a wrapper on the specified Map which synchronizes all access to the Map. |
static Set |
synchronizedSet(Set set)
Answers a wrapper on the specified Set which synchronizes all access to the Set. |
static SortedMap |
synchronizedSortedMap(SortedMap map)
Answers a wrapper on the specified SortedMap which synchronizes all access to the SortedMap. |
static SortedSet |
synchronizedSortedSet(SortedSet set)
Answers a wrapper on the specified SortedSet which synchronizes all access to the SortedSet. |
static Collection |
unmodifiableCollection(Collection collection)
Answers a wrapper on the specified Collection which throws an UnsupportedOperationException whenever
an attempt is made to modify the Collection. |
static List |
unmodifiableList(List list)
Answers a wrapper on the specified List which throws an UnsupportedOperationException whenever an
attempt is made to modify the List. |
static Map |
unmodifiableMap(Map map)
Answers a wrapper on the specified Map which throws an UnsupportedOperationException whenever an
attempt is made to modify the Map. |
static Set |
unmodifiableSet(Set set)
Answers a wrapper on the specified Set which throws an UnsupportedOperationException whenever an
attempt is made to modify the Set. |
static SortedMap |
unmodifiableSortedMap(SortedMap map)
Answers a wrapper on the specified SortedMap which throws an UnsupportedOperationException whenever an
attempt is made to modify the SortedMap. |
static SortedSet |
unmodifiableSortedSet(SortedSet set)
Answers a wrapper on the specified SortedSet which throws an UnsupportedOperationException whenever an
attempt is made to modify the SortedSet. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Map EMPTY_MAP
public static final Set EMPTY_SET
public static final List EMPTY_LIST
public static final java.lang.Class CLASS_INSTANCE
Method Detail |
---|
public static List unmodifiableList(List list)
UnsupportedOperationException
whenever an
attempt is made to modify the List.
list
- the List
public static List synchronizedList(List list)
list
- the List
public static Map synchronizedMap(Map map)
map
- the Map
public static void copy(List destination, List source)
destination
- source
-
java.lang.IndexOutOfBoundsException
- when the destination List is smaller than the source List
java.lang.UnsupportedOperationException
- when replacing an element in the destination list is not supportedpublic static boolean addAll(Collection c, java.lang.Object[] a)
c
- the collection the elements are to be inserted intoa
- the elements to insert
java.lang.UnsupportedOperationException
- when the method is not supported
java.lang.NullPointerException
- when c or elements is null, or elements contains one or more null elements and c doesn't support null
elementspublic static int binarySearch(List list, java.lang.Object object)
list
- the sorted List to searchobject
- the element to find
java.lang.ClassCastException
- when an element in the List or the search element does not implement Comparable, or cannot be compared to
each otherpublic static int binarySearch(List list, java.lang.Object object, Comparator comparator)
T
- The element typelist
- the sorted List to searchobject
- the element to findcomparator
- the Comparator. If the comparator is null
then the search uses the objects' natural ordering.
java.lang.ClassCastException
- when an element in the list and the searched element cannot be compared to each other using the
Comparatorpublic static List checkedList(List list, java.lang.Class type)
list
- the listtype
- the type of the elements is permitted to insert
public static Collection checkedCollection(Collection c, java.lang.Class type)
c
- the collectiontype
- the type of the elements is permitted to insert
public static Map checkedMap(Map m, java.lang.Class keyType, java.lang.Class valueType)
m
- the mapkeyType
- the type of keys permitted to be insertedvalueType
- the type of values permitted to be inserted
public static Set checkedSet(Set s, java.lang.Class type)
s
- the settype
- the type of the elements is permitted to insert
public static SortedMap checkedSortedMap(SortedMap m, java.lang.Class keyType, java.lang.Class valueType)
m
- the sorted mapkeyType
- the type of keys permitted to be insertedvalueType
- the type of values permitted to be inserted
public static SortedSet checkedSortedSet(SortedSet s, java.lang.Class type)
s
- the sorted settype
- the type of the elements is permitted to insert
public static boolean disjoint(Collection c1, Collection c2)
c1
- the first collectionc2
- the second collection
java.lang.NullPointerException
- if one of the collections is nullpublic static int frequency(Collection c, java.lang.Object o)
Returns the number of elements in the Collection
that match the Object
passed. If the
Object
is null
, then the number of null
elements is returned.
c
- The Collection
to search.o
- The Object
to search for.
java.lang.NullPointerException
- if the Collection
parameter is null
.public static final List emptyList()
List
.
List
.EMPTY_LIST
public static final Set emptySet()
Set
.
Set
.EMPTY_SET
public static final Map emptyMap()
Map
.
Map
.EMPTY_MAP
public static java.util.Enumeration enumeration(Collection collection)
collection
- the Collection to enumerate
public static void fill(List list, java.lang.Object object)
list
- the List to fillobject
- the fill element
java.lang.UnsupportedOperationException
- when replacing an element in the List is not supportedpublic static int indexOfSubList(List list, List sublist)
list
for sublist
and answers the beginning index of the first occurrence.
-1 is returned if the sublist
does not exist in list
list
- the List to search sublist
insublist
- the List to search in list
sublist
in list
, or -1public static int lastIndexOfSubList(List list, List sublist)
list
for sublist
and answers the beginning index of the last occurrence.
-1 is returned if the sublist
does not exist in list
list
- the List to search sublist
insublist
- the List to search in list
sublist
in list
, or -1public static ArrayList list(java.util.Enumeration enumeration)
enumeration
. The elements in the returned ArrayList
are in the same order as in the enumeration
.
enumeration
- Enumeration
public static java.lang.Object max(Collection collection)
collection
- the Collection to search
java.lang.ClassCastException
- when an element in the Collection does not implement Comparable or elements cannot be compared to each
otherpublic static java.lang.Object max(Collection collection, Comparator comparator)
collection
- the Collection to searchcomparator
- the Comparator
java.lang.ClassCastException
- when elements in the Collection cannot be compared to each other using the Comparatorpublic static java.lang.Object min(Collection collection)
collection
- the Collection to search
java.lang.ClassCastException
- when an element in the Collection does not implement Comparable or elements cannot be compared to each
otherpublic static java.lang.Object min(Collection collection, Comparator comparator)
collection
- the Collection to searchcomparator
- the Comparator
java.lang.ClassCastException
- when elements in the Collection cannot be compared to each other using the Comparatorpublic static List nCopies(int length, java.lang.Object object)
length
- the size of the returned Listobject
- the element
length
copies of the element
java.lang.IllegalArgumentException
- when length < 0
public static boolean replaceAll(List list, java.lang.Object obj, java.lang.Object obj2)
obj
in list
with newObj
. If the
obj
is null
, then all occurrences of null
is replaced with
newObj
.
list
- the List to modifyobj
- the Object to find and replace occurrences of.obj2
- the Object to replace all occurrences of obj
in list
obj
has been found in list
java.lang.UnsupportedOperationException
- if the list does not support setting elementspublic static void rotate(List lst, int dist)
list
by the distance dist
e.g. for a given list with elements [1, 2, 3, 4, 5, 6, 7, 8, 9, 0], calling rotate(list, 3) or rotate(list, -7) would modify the list to look like this: [8, 9, 0, 1, 2, 3, 4, 5, 6, 7]
lst
- dist
- It can be any integer: 0, positive, negative, larger than the list sizepublic static void reverse(List list)
List
with the order of its contained elements reversed.
list
- the List to reverse
java.lang.UnsupportedOperationException
- when replacing an element in the List is not supportedpublic static Comparator reverseOrder()
A Comparator which reverses the natural order of the elements. The Comparator
that's returned is
Serializable
.
Comparator
instance.Comparator
,
Comparable
,
Serializable
public static Comparator reverseOrder(Comparator c)
Returns a Comparator
that reverses the order of the Comparator
passed. If the
Comparator
passed is null
, then this method is equivalent to reverseOrder()
.
The Comparator
that's returned is Serializable
if the Comparator
passed is
serializable or null
.
c
- The Comparator
to reverse or null
.
Comparator
instance.Comparator
public static Set singleton(java.lang.Object object)
object
- the element
public static List singletonList(java.lang.Object object)
object
- the element
public static Map singletonMap(java.lang.Object key, java.lang.Object value)
key
- the keyvalue
- the value
public static void sort(List list)
list
- the List to be sorted
java.lang.ClassCastException
- when an element in the List does not implement Comparable or elements cannot be compared to each otherpublic static void sort(List list, Comparator comparator)
list
- the List to be sortedcomparator
- the Comparator
java.lang.ClassCastException
- when elements in the List cannot be compared to each other using the Comparatorpublic static void swap(List list, int index1, int index2)
list
at indices index1
and index2
list
- the List to manipulate onindex1
- int position of the first element to swap with the element in index2index2
- int position of the other element
java.lang.IndexOutOfBoundsException
- if index1 or index2 is out of range of this listpublic static Collection synchronizedCollection(Collection collection)
collection
- the Collection
public static Set synchronizedSet(Set set)
set
- the Set
public static SortedMap synchronizedSortedMap(SortedMap map)
map
- the SortedMap
public static SortedSet synchronizedSortedSet(SortedSet set)
set
- the SortedSet
public static Collection unmodifiableCollection(Collection collection)
UnsupportedOperationException
whenever
an attempt is made to modify the Collection.
collection
- the Collection
public static Map unmodifiableMap(Map map)
UnsupportedOperationException
whenever an
attempt is made to modify the Map.
map
- the Map
public static Set unmodifiableSet(Set set)
UnsupportedOperationException
whenever an
attempt is made to modify the Set.
set
- the Set
public static SortedMap unmodifiableSortedMap(SortedMap map)
UnsupportedOperationException
whenever an
attempt is made to modify the SortedMap.
map
- the SortedMap
public static SortedSet unmodifiableSortedSet(SortedSet set)
UnsupportedOperationException
whenever an
attempt is made to modify the SortedSet.
set
- the SortedSet
public static void shuffle(List list)
list
- the List to shuffle
java.lang.UnsupportedOperationException
- when replacing an element in the List is not supportedpublic static void shuffle(List list, java.util.Random random)
list
- the List to shufflerandom
- the random number generator
java.lang.UnsupportedOperationException
- when replacing an element in the List is not supportedpublic static final void putAll(Hashtable source, java.util.Hashtable dest)
public static final void putAll(java.util.Hashtable source, Hashtable dest)
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |