org.limewire.collection
Class RoundRobinSetQueue<T>
java.lang.Object
org.limewire.collection.RoundRobinQueue<T>
org.limewire.collection.RoundRobinSetQueue<T>
public class RoundRobinSetQueue<T>
- extends RoundRobinQueue<T>
A round-robin queue where types are unique.
LinkedList<String> ll = new LinkedList<String>();
ll.add("Abby");
ll.add("Bob");
ll.add("Bob"); //duplicate that isn't enqueue'd in rrq
System.out.println("ll size: " + ll.size());
RoundRobinSetQueue<String> rrq = new RoundRobinSetQueue<String>();
for(String o : ll)
rrq.enqueue(o);
System.out.println("rrq size: " + rrq.size() + " content: ");
for(int i = 0; i < rrq.size() ; i++)
System.out.println(rrq.next());
Output:
ll size: 3
rrq size: 2 content:
Abby
Bob
|
Method Summary |
void |
enqueue(T value)
enqueues the specified object in the round-robin queue. |
void |
remove(T o)
Removes the next occurrence of the specified object |
void |
removeAllOccurences(T o)
Removes all occurrences of the given object in the list. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RoundRobinSetQueue
public RoundRobinSetQueue()
enqueue
public void enqueue(T value)
- Description copied from class:
RoundRobinQueue
- enqueues the specified object in the round-robin queue.
- Overrides:
enqueue in class RoundRobinQueue<T>
- Parameters:
value - the object to add to the queue
remove
public void remove(T o)
- Description copied from class:
RoundRobinQueue
- Removes the next occurrence of the specified object
- Overrides:
remove in class RoundRobinQueue<T>
- Parameters:
o - the object to remove from the queue.
removeAllOccurences
public void removeAllOccurences(T o)
- Description copied from class:
RoundRobinQueue
- Removes all occurrences of the given object in the list.
- Overrides:
removeAllOccurences in class RoundRobinQueue<T>
- Parameters:
o - the object to remove.
Copyright © 2008 Lime Wire LLC. All Rights Reserved.