1 9 10 package org.jboss.portal.common.context; 11 12 import java.util.Collections ; 13 import java.util.Iterator ; 14 import java.util.LinkedList ; 15 import java.util.List ; 16 import java.util.Map ; 17 18 22 public class ChildrenStrategy 23 { 24 25 public ChildrenStrategy(Map children) 26 { 27 this.children = children; 28 } 29 30 private Map children; 31 32 public void append(String name, Context ctx) 33 { 34 List child = (List )children.get(name); 35 if (child == null) 36 { 37 child = new LinkedList (); 38 children.put(name, child); 39 } 40 child.add(ctx); 41 } 42 43 public Iterator childIterator(String name) 44 { 45 List child = (List )children.get(name); 46 return child != null ? child.iterator() : Collections.EMPTY_LIST.iterator(); 47 } 48 49 } 50 | Popular Tags |