IdentifiableContainerBase.javaAPI DocJava SE 5 API1757Fri Aug 26 14:54:36 BST


public class IdentifiableContainerBase extends 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.
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)( ;
		    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() ;
	} ;