1 19 package org.netbeans.mdr.handlers; 20 21 import java.util.*; 22 23 import org.netbeans.mdr.storagemodel.TypedCollection; 24 25 30 public class CollectionUnwrapper extends AbstractList { 31 private final Object [] innerList; 32 33 public CollectionUnwrapper(Collection elements, Collection typedList) { 34 super(); 35 36 int i = 0; 37 TypedCollection list; 38 if (typedList instanceof TypedCollection) { 39 list = (TypedCollection) typedList; 40 } else { 41 list = null; 42 } 43 innerList = new Object [elements.size()]; 44 for (Iterator it = elements.iterator(); it.hasNext();) { 45 Object element = it.next(); 46 if (list != null) { 47 list.checkType(element); 48 } 49 innerList[i++] = IndexSetWrapper.unwrap(element); 50 } 51 } 52 53 public CollectionUnwrapper(Collection elements) { 54 this(elements, null); 55 } 56 57 public int size() { 58 return innerList.length; 59 } 60 61 public Object get(int param) { 62 return innerList[param]; 63 } 64 } 65 | Popular Tags |