1 7 8 package com.sun.corba.se.spi.ior; 9 10 import java.util.List ; 11 import java.util.ArrayList ; 12 import java.util.Iterator ; 13 14 import com.sun.corba.se.impl.ior.FreezableList ; 15 16 import com.sun.corba.se.spi.ior.TaggedComponent ; 17 import com.sun.corba.se.spi.ior.Identifiable ; 18 19 25 public class IdentifiableContainerBase extends FreezableList 26 { 27 30 public IdentifiableContainerBase() 31 { 32 super( new ArrayList () ) ; 33 } 34 35 38 public Iterator iteratorById( final int id) 39 { 40 return new Iterator () { 41 Iterator iter = IdentifiableContainerBase.this.iterator() ; 42 Object current = advance() ; 43 44 private Object advance() 45 { 46 while (iter.hasNext()) { 47 Identifiable ide = (Identifiable)(iter.next()) ; 48 if (ide.getId() == id) 49 return ide ; 50 } 51 52 return null ; 53 } 54 55 public boolean hasNext() 56 { 57 return current != null ; 58 } 59 60 public Object next() 61 { 62 Object result = current ; 63 current = advance() ; 64 return result ; 65 } 66 67 public void remove() 68 { 69 iter.remove() ; 70 } 71 } ; 72 } 73 } 74 | Popular Tags |