Known subclasses:

This class contains various functions for manipulating sequences (such as
sorting and searching). All of these functions are nonmutative, they do not
change the input-parameters, but create new instances for output.

Profile: common

Inherited Variables

Searches the specified sequence for the specified object using the
binary search algorithm.

Searches the specified sequence for the specified object using the
binary search algorithm. The sequence must be sorted into ascending
order according to the natural ordering of its elements (as by
the sort(Sequence) method) prior to making this call.

If it is not sorted, the results are undefined. If the array contains
multiple elements equal to the specified object, there is no guarantee
which one will be found.

Parameters

seq

The sequence to be searched.

key

The value to be searched for.

Returns

Integer

Index of the search key, if it is contained in the array;
otherwise, (-(insertion point) - 1). The insertion point is
defined as the point at which the key would be inserted into the
array: the index of the first element greater than the key, or
a.length
if all elements in the array are less than the
specified key. Note that this guarantees that the return value
will be >= 0 if and only if the key is found.

Searches the specified array for the specified object using the
binary search algorithm.

Searches the specified array for the specified object using the
binary search algorithm. The array must be sorted into ascending
order according to the specified comparator (as by the
sort(Sequence, Comparator super T>) method) prior to
making this call.

If it is not sorted, the results are undefined. If the array contains
multiple elements equal to the specified object, there is no guarantee
which one will be found.

Parameters

seq

The sequence to be searched.

key

The value to be searched for.

c

The Comparator by which the array is ordered.
A null value indicates that the elements' natural
ordering should be used.

Returns

Integer

Index of the search key, if it is contained in the array;
otherwise, (-(insertion point) - 1). The insertion point is
defined as the point at which the key would be inserted into the
array: the index of the first element greater than the key, or
a.length
if all elements in the array are less than the
specified key. Note that this guarantees that the return value
will be >= 0 if and only if the key is found.

Returns true if the two specified sequences are equal to one another.
The two sequences are considered equal if both sequences contain the same
number of elements, and all corresponding pairs of elements in the two
sequences are identical. In other words, the two sequences are equal if
they contain the same elements in the same order.

Returns the element with the maximum value in the specified sequence,
according to the natural ordering of its elements.

Returns the element with the maximum value in the specified sequence,
according to the natural ordering of its elements. All elements in the
sequence must implement the Comparable interface. Furthermore,
all elements in the sequence must be mutually comparable (that is,
e1.compareTo(e2) must not throw a ClassCastException
for any elements e1 and e2 in the sequence).

If the sequence contains multiple elements with the maximum value,
there is no guarantee which one will be found.

Returns the element with the maximum value in the specified sequence,
according to the specified Comparator.

Returns the element with the maximum value in the specified sequence,
according to the specified Comparator. All elements in the
sequence must be mutually comparable by the specified Comparator
(that is, c.compare(e1, e2) must not throw a
ClassCastException for any elements e1 and e2
in the sequence).

If the sequence contains multiple elements with the maximum value,
there is no guarantee which one will be found.

Parameters

seq

The sequence to be searched.

c

The Comparator to determine the order of the sequence.
A null value indicates that the elements' natural
ordering should be used.

Returns the element with the minimum value in the specified sequence,
according to the natural ordering of its elements.

Returns the element with the minimum value in the specified sequence,
according to the natural ordering of its elements. All elements in the
sequence must implement the Comparable interface. Furthermore,
all elements in the sequence must be mutually comparable (that is,
e1.compareTo(e2) must not throw a ClassCastException
for any elements e1 and e2 in the sequence).

If the sequence contains multiple elements with the minimum value,
there is no guarantee which one will be found.

Returns the element with the minimum value in the specified sequence,
according to the specified Comparator.

Returns the element with the minimum value in the specified sequence,
according to the specified Comparator. All elements in the
sequence must be mutually comparable by the specified Comparator
(that is, c.compare(e1, e2) must not throw a
ClassCastException for any elements e1 and e2
in the sequence).

If the sequence contains multiple elements with the minimum value,
there is no guarantee which one will be found.

Parameters

seq

The sequence to be searched.

c

The Comparator to determine the order of the sequence.
A null value indicates that the elements' natural
ordering should be used.

Randomly permutes the specified list using a default source of randomness.

Randomly permutes the specified list using a default source of randomness.
All permutations occur with approximately equal likelihood.

The hedge "approximately" is used in the foregoing description because
default source of randomness is only approximately an unbiased source of
independently chosen bits. If it were a perfect source of randomly chosen
bits, then the algorithm would choose permutations with perfect uniformity.

This method is immutative, the result is returned in a new sequence,
while the original sequence is left untouched.

Sorts the specified sequence of objects into ascending order, according
to the natural ordering of its elements.

Sorts the specified sequence of objects into ascending order, according
to the natural ordering of its elements. All elements in the sequence
must implement the Comparable interface. Furthermore, all
elements in the sequence must be mutually comparable (that is,
e1.compareTo(e2) must not throw a ClassCastException
for any elements e1 and e2 in the sequence).

This method is immutative, the result is returned in a new sequence,
while the original sequence is left untouched.

This sort is guaranteed to be stable: equal elements will not be
reordered as a result of the sort.

The sorting algorithm is a modified mergesort (in which the merge is
omitted if the highest element in the low sublist is less than the
lowest element in the high sublist). This algorithm offers guaranteed
n*log(n) performance.

Sorts the specified sequence of objects according to the order induced
by the specified Comparator.

Sorts the specified sequence of objects according to the order induced
by the specified Comparator. All elements in the sequence must be
mutually comparable by the specified Comparator (that is,
c.compare(e1, e2) must not throw a ClassCastException
for any elements e1 and e2 in the sequence).

This method is immutative, the result is returned in a new sequence,
while the original sequence is left untouched.

This sort is guaranteed to be stable: equal elements will not be
reordered as a result of the sort.

The sorting algorithm is a modified mergesort (in which the merge is
omitted if the highest element in the low sublist is less than the
lowest element in the high sublist). This algorithm offers guaranteed
n*log(n) performance.

Parameters

seq

The sequence to be sorted.

c

The Comparator to determine the order of the sequence.
A null value indicates that the elements' natural
ordering should be used.