-
- All Implemented Interfaces:
public final class RandomizedCollection
-
-
Constructor Summary
Constructors Constructor Description RandomizedCollection()
-
Method Summary
Modifier and Type Method Description final HashMap<Integer, HashSet<Integer>>
getM2a()
final ArrayList<Integer>
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. -
-
Method Detail
-
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.
-
-
-
-