1 4 package polyglot.util; 5 6 import java.util.*; 7 8 13 public class TransformingList extends java.util.AbstractList { 14 protected final Transformation trans; 15 protected final List underlying; 16 17 18 public TransformingList(Collection underlying, Transformation trans) { 19 this(new ArrayList(underlying), trans); 20 } 21 22 public TransformingList(List underlying, Transformation trans) { 23 this.underlying = underlying; 24 this.trans = trans; 25 } 26 27 public int size() { return underlying.size(); } 28 29 public Object get(int index) { 30 return trans.transform(underlying.get(index)); 31 } 32 33 } 34 35 | Popular Tags |