LimeWire Collection Component API

org.limewire.collection
Class RoundRobinSetQueue<T>

java.lang.Object
  extended by org.limewire.collection.RoundRobinQueue<T>
      extended by 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


Constructor Summary
RoundRobinSetQueue()
           
 
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 org.limewire.collection.RoundRobinQueue
clear, next, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoundRobinSetQueue

public RoundRobinSetQueue()
Method Detail

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.

LimeWire Collection Component API

Copyright © 2008 Lime Wire LLC. All Rights Reserved.