Package 

Class RandomizedCollection

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final <ERROR CLASS> m2a
      private final <ERROR CLASS> a2m
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final <ERROR CLASS> getM2a()
      final <ERROR CLASS> getA2m()
      final Boolean insert(Integer x) Inserts a value to the collection.
      final Boolean remove(Integer x) Removes a value from the collection.
      final Integer getRandom() Get a random element from the collection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RandomizedCollection

        RandomizedCollection()
    • Method Detail

      • getM2a

         final <ERROR CLASS> getM2a()
      • getA2m

         final <ERROR CLASS> getA2m()
      • insert

         final Boolean insert(Integer x)

        Inserts a value to the collection. Returns true if the collection did not already contain the specified element.

      • remove

         final Boolean remove(Integer x)

        Removes a value from the collection. Returns true if the collection contained the specified element.