FileDocCategorySizeDatePackage
IdentifiableContainerBase.javaAPI DocJava SE 5 API1757Fri Aug 26 14:54:36 BST 2005com.sun.corba.se.spi.ior

IdentifiableContainerBase

public class IdentifiableContainerBase extends com.sun.corba.se.impl.ior.FreezableList
Convenience class for defining objects that contain lists of Identifiables. Mainly implements iteratorById. Also note that the constructor creates the list, which here is always an ArrayList, as this is much more efficient overall for short lists.
author
Ken Cavanaugh

Fields Summary
Constructors Summary
public IdentifiableContainerBase()
Create this class with an empty list of identifiables. The current implementation uses an ArrayList.

	super( new ArrayList() ) ;
    
Methods Summary
public java.util.IteratoriteratorById(int id)
Return an iterator which iterates over all contained Identifiables with type given by id.

	return new Iterator() {
	    Iterator iter = IdentifiableContainerBase.this.iterator() ;
	    Object current = advance() ;

	    private Object advance()
	    {
		while (iter.hasNext()) {
		    Identifiable ide = (Identifiable)(iter.next()) ;
		    if (ide.getId() == id)
			return ide ;
		}

		return null ;
	    }

	    public boolean hasNext() 
	    {
		return current != null ;
	    }

	    public Object next()
	    {
		Object result = current ;
		current = advance() ;
		return result ;
	    }

	    public void remove()
	    {
		iter.remove() ;
	    }
	} ;