org.zkoss.util
Class IdentityHashSet

java.lang.Object
  extended by java.util.AbstractCollection
      extended by java.util.AbstractSet
          extended by org.zkoss.util.IdentityHashSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.Set

public class IdentityHashSet
extends java.util.AbstractSet
implements java.util.Set, java.lang.Cloneable, java.io.Serializable

Like java.util.InternalHashMap, it uses == and System.identityHashCode for doing HashSet.

Author:
tomyeh
See Also:
IdentityComparator, Serialized Form

Constructor Summary
IdentityHashSet()
          Constructs a new, empty set; the backing IdentityHashMap instance has default capacity (32).
IdentityHashSet(java.util.Collection c)
          Constructs a new set containing the elements in the specified collection.
IdentityHashSet(int expectedMaxSize)
          Constructs a new, empty set with the specified expected maximum size.
 
Method Summary
 boolean add(java.lang.Object o)
           
 void clear()
           
 java.lang.Object clone()
           
 boolean contains(java.lang.Object o)
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object o)
           
 int 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.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

IdentityHashSet

public IdentityHashSet()
Constructs a new, empty set; the backing IdentityHashMap instance has default capacity (32).


IdentityHashSet

public IdentityHashSet(java.util.Collection c)
Constructs a new set containing the elements in the specified collection.

Parameters:
c - the collection whose elements are to be placed into this set.
Throws:
java.lang.NullPointerException - if the specified collection is null.

IdentityHashSet

public IdentityHashSet(int expectedMaxSize)
Constructs a new, empty set with the specified expected maximum size.

Parameters:
expectedMaxSize - the expected maximum size of the map.
Throws:
java.lang.IllegalArgumentException - if expectedMaxSize is negative
Method Detail

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set
Specified by:
iterator in class java.util.AbstractCollection

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.Set
Specified by:
size in class java.util.AbstractCollection

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.Set
Overrides:
isEmpty in class java.util.AbstractCollection

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set
Overrides:
contains in class java.util.AbstractCollection

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Overrides:
add in class java.util.AbstractCollection

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set
Overrides:
remove in class java.util.AbstractCollection

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.Set
Overrides:
clear in class java.util.AbstractCollection

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo