-
Nested Class Summary
Nested Classes
-
Constructor Summary
Constructors
Create an empty random queue.
-
Method Summary
Remove and return a random item.
void
boolean
Return an iterator over the items in random order.
static void
Return (but do not remove) a random item.
int
Return the number of elements.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
MyRandomQueue
Create an empty random queue.
-
Method Details
-
-
size
Return the number of elements.
-
-
sample
Return (but do not remove) a random item.
-
dequeue
Remove and return a random item.
-
iterator
Return an iterator over the items in random order.
- Specified by:
iterator
in interface Iterable<T>
-