Package com.globalmentor.collections
Class Vectors
java.lang.Object
com.globalmentor.collections.Vectors
Various vector manipulating functions.
- Author:
- Garret Wilson
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> Vector<E>
Randomizes the elements of the vector.static <E> Vector<E>
Randomizes the elements of the vector with the specified random number generator.static <E> void
Sorts a vector containingComparable
objects using a quicksort algorithm.
-
Constructor Details
-
Vectors
public Vectors()
-
-
Method Details
-
randomize
Randomizes the elements of the vector.- Type Parameters:
E
- The type of element stored in the vector.- Parameters:
vector
- The vector to be randomized.- Returns:
- The same vector, randomized.
-
sort
Sorts a vector containingComparable
objects using a quicksort algorithm.- Type Parameters:
E
- The type of element stored in the vector.- Parameters:
vector
- The vector to be sorted.- Throws:
ClassCastException
- if an element in the vector does not implementComparable
.- See Also:
-
quickSort(Vector, int, int)
Comparable
-
randomize
Randomizes the elements of the vector with the specified random number generator.- Type Parameters:
E
- The type of element stored in the vector.- Parameters:
vector
- The vector to be randomized.random
- The random number generator to use.- Returns:
- The same vector, randomized.
-