Level 163 Level 165
Level 164

Collection Algorithms


21 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
the collections framework
defines several algorithms that can be applied to collections and maps
static void copy(List list1, List list2)
Copies the elements of list2 to list1.
static void fill(List list, Object obj)
Assigns obj to each element of list.
static ArrayList list(Enumeration enum)
Returns an ArrayList that contains the elements of enum.
static Object max(Collection c)
Returns the maximum element in c as determined by natural ordering. the collection need not be sorted.
static Object min(Collection c)
Returns the minimum element in c as determined by natural ordering.
static List nCopies(int num, Object obj)
Returns num copies of obj contained in an immutable list. num must be greater than or equal to zero.
static void reverse(List list)
Reverses the sequence in list.
static Comparator reverseOrder()
Returns a reverse comparator
static void rotate(List list, int n)
Rotates list by n places to the right. To rotate left, use a negative value for n.
static void shuffle(List list, Random r)
Shuffles (i.e., randomizes) the elements in list by using r as a source of random numbers.
static void shuffle(List list)
Shuffles (i.e., randomizes) the elements in list.
static Set singleton(Object obj)
Returns obj as an immutable set. This is an easy way to convert a single object into a set.
static List singletonList(Object obj)
Returns obj as an immutable list. This is an easy way to convert a single object into a list.
static void sort(List list)
Sorts the elements of list as determined by their natural ordering.
static List synchronizedList(List list)
Returns a thread-safe list backed by list.
static Map synchronizedMap(Map m)
Returns a thread-safe map backed by m.
static Set synchronizedSet(Set s)
Returns a thread-safe set backed by s.
static List unmodifiableList(List list)
Returns an unmodifiable list backed by list.
static Map unmodifiableMap(Map m)
Returns an unmodifiable map backed by m.
static Set unmodifiableSet(Set s)
Returns an unmodifiable set backed by s.