-
Enhancement
-
Resolution: Fixed
-
P4
-
1.3.0
-
None
-
beta
-
generic
-
generic
-
Verified
The Collections utility class would benefit from the addition of
a few well-chosen algorithms:
void rotate(List l, int distance) - Rotates all of the elements elements
clockwise by the the given distance. This operation is common in GUI
computations: moving one or more columns in a table can be accomplished
efficiently by applying this operation to a sublist. This operation is
also common in mathematical and scientific calculations. While very short,
this operation is difficult to program correctly and efficiently.
boolean replaceAll(List l, Object oldVal, Object newVal) - Replaces all
occurences of one specified value with another. This is essentially a
covenience method. Though not difficult to program, it's very commonly
needed. Further, our implementation can be faster than end-user
implementations because it has access to the internals of our collections.
int indexOfRange(List l, List range)/lastIndexOfRange(List l, List range)
- Returns the index of the leftmost/rightmost sublist of the specified
list (l) that is equal the to the specified range. Commonly used in
many domains including text processing. Surprisingly difficult to
get this right, even if the "naive" algorithm is used.
a few well-chosen algorithms:
void rotate(List l, int distance) - Rotates all of the elements elements
clockwise by the the given distance. This operation is common in GUI
computations: moving one or more columns in a table can be accomplished
efficiently by applying this operation to a sublist. This operation is
also common in mathematical and scientific calculations. While very short,
this operation is difficult to program correctly and efficiently.
boolean replaceAll(List l, Object oldVal, Object newVal) - Replaces all
occurences of one specified value with another. This is essentially a
covenience method. Though not difficult to program, it's very commonly
needed. Further, our implementation can be faster than end-user
implementations because it has access to the internals of our collections.
int indexOfRange(List l, List range)/lastIndexOfRange(List l, List range)
- Returns the index of the leftmost/rightmost sublist of the specified
list (l) that is equal the to the specified range. Commonly used in
many domains including text processing. Surprisingly difficult to
get this right, even if the "naive" algorithm is used.
- relates to
-
JDK-4513189 java.util.Collections.list has improper return type
-
- Resolved
-