Class Vectors

java.lang.Object
com.globalmentor.collections.Vectors

public class Vectors extends Object
Various vector manipulating functions.
Author:
Garret Wilson
See Also:
  • Constructor Details

    • Vectors

      public Vectors()
  • Method Details

    • randomize

      public static <E> Vector<E> randomize(Vector<E> vector)
      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

      public static <E> void sort(Vector<E> vector)
      Sorts a vector containing Comparable 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 implement Comparable.
      See Also:
    • randomize

      public static <E> Vector<E> randomize(Vector<E> vector, Random random)
      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.