LimeWire Collection Component API

org.limewire.collection
Class RandomOrderHashSet<T>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet<E>
              extended by org.limewire.collection.FixedSizeArrayHashSet<T>
                  extended by org.limewire.collection.RandomOrderHashSet<T>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Collection<T>, RandomAccess, Set<T>, RandomAccessCollection<T>

public class RandomOrderHashSet<T>
extends FixedSizeArrayHashSet<T>

A variant of FixedSizeArrayHashSet that allows iterations over its elements in random order.

    LinkedList<Integer> linkedlist1 = new LinkedList<Integer>();
    for(int i = 0; i < 5; i++)
        linkedlist1.add(i);

    RandomOrderHashSet<Integer> rohs = new RandomOrderHashSet<Integer>(linkedlist1);                
    System.out.println(rohs);

    Random Output:
        [1, 3, 0, 2, 4]

See Also:
Serialized Form

Constructor Summary
RandomOrderHashSet(Collection<? extends T> c)
           
RandomOrderHashSet(int initialCapacity)
           
RandomOrderHashSet(int capacity, Collection<? extends T> c)
           
RandomOrderHashSet(int maxSize, int initialCapacity, float loadFactor)
           
 
Method Summary
 Iterator<T> iterator()
           
 
Methods inherited from class org.limewire.collection.FixedSizeArrayHashSet
add, clear, clone, contains, get, isEmpty, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

RandomOrderHashSet

public RandomOrderHashSet(Collection<? extends T> c)

RandomOrderHashSet

public RandomOrderHashSet(int capacity,
                          Collection<? extends T> c)

RandomOrderHashSet

public RandomOrderHashSet(int maxSize,
                          int initialCapacity,
                          float loadFactor)

RandomOrderHashSet

public RandomOrderHashSet(int initialCapacity)
Method Detail

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>
Specified by:
iterator in interface Collection<T>
Specified by:
iterator in interface Set<T>
Overrides:
iterator in class FixedSizeArrayHashSet<T>

LimeWire Collection Component API

Copyright © 2009 Lime Wire LLC. All Rights Reserved.