Class RouletteList<T>

All Implemented Interfaces:
Iterable<T>, Collection<T>

public class RouletteList<T> extends Object implements Collection<T>
A structure composed of a set of collections of a given size in which additions happen to the next list in the roulette before it is spun.
  • Constructor Details

    • RouletteList

      public RouletteList(int numLists, int initialCollectionSize)
      Constructs a roulette list with a given size.
      numLists - The number of collections.
      initialCollectionSize - The initial size of each collection.
  • Method Details

    • getList

      public List<T> getList(int index)
      Returns the list for the given index. If the index is negative or greater than the number of lists in the roulette, it asserts an exception.
      index - The index.
      The list at the given index in this roulette.
    • getNumCollections

      public int getNumCollections()
    • size

      public int size()
      Specified by:
      size in interface Collection<T>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<T>
    • contains

      public boolean contains(Object o)
      Specified by:
      contains in interface Collection<T>
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Collection<T>
      Specified by:
      iterator in interface Iterable<T>
    • toArray

      public T[] toArray()
      Specified by:
      toArray in interface Collection<T>
    • toArray

      public <T> T[] toArray(T[] a)
      Specified by:
      toArray in interface Collection<T>
    • toArrayConcrete

      public <T> T[] toArrayConcrete(T[] a)
    • add

      public boolean add(T e)
      Specified by:
      add in interface Collection<T>
    • remove

      public boolean remove(Object o)
      Specified by:
      remove in interface Collection<T>
    • containsAll

      public boolean containsAll(Collection<?> c)
      Specified by:
      containsAll in interface Collection<T>
    • addAll

      public boolean addAll(Collection<? extends T> c)
      Specified by:
      addAll in interface Collection<T>
    • removeAll

      public boolean removeAll(Collection<?> c)
      Specified by:
      removeAll in interface Collection<T>
    • retainAll

      public boolean retainAll(Collection<?> c)
      Specified by:
      retainAll in interface Collection<T>
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<T>