FileDocCategorySizeDatePackage
IdentitySet.javaAPI DocHibernate 3.2.51838Fri Dec 09 08:27:06 GMT 2005org.hibernate.util

IdentitySet

public class IdentitySet extends Object implements Set
Set implementation that use == instead of equals() as its comparison mechanism that base its implementation of IdentityMap
author
Emmanuel Bernard

Fields Summary
private Map
map
private static final Object
DUMP_VALUE
Constructors Summary
public IdentitySet()


	  
		this.map = IdentityMap.instantiate( 10 );
	
Methods Summary
public booleanadd(java.lang.Object o)

		return map.put( o, DUMP_VALUE) == null;
	
public booleanaddAll(java.util.Collection c)

		Iterator it = c.iterator();
		boolean changed = false;
		while ( it.hasNext() ) {
			if ( this.add( it.next() ) ) changed = true;
		}
		return changed;
	
public voidclear()

		map.clear();
	
public booleancontains(java.lang.Object o)

		return map.get( o ) == DUMP_VALUE;
	
public booleancontainsAll(java.util.Collection c)

		Iterator it = c.iterator();
		while ( it.hasNext() ) {
			if ( ! map.containsKey( it.next() ) ) return false;
		}
		return true;
	
public booleanisEmpty()

		return map.isEmpty();
	
public java.util.Iteratoriterator()

		return map.entrySet().iterator();
	
public booleanremove(java.lang.Object o)

		return map.remove( o ) == DUMP_VALUE;
	
public booleanremoveAll(java.util.Collection c)

		Iterator it = c.iterator();
		boolean changed = false;
		while ( it.hasNext() ) {
			if ( this.remove( it.next() ) ) changed = true;
		}
		return changed;
	
public booleanretainAll(java.util.Collection c)

		//doable if needed
		throw new UnsupportedOperationException();
	
public intsize()

		return map.size();
	
public java.lang.Object[]toArray()

		return map.entrySet().toArray();
	
public java.lang.Object[]toArray(java.lang.Object[] a)

		return map.entrySet().toArray(a);