001    package railo.runtime.type.it;
002    
003    import java.util.Iterator;
004    
005    import railo.runtime.type.Collection;
006    import railo.runtime.type.Collection.Key;
007    import railo.runtime.type.KeyImpl;
008    
009    public class CollectionIterator implements Iterator {
010    
011            private Iterator keys;
012            private Collection coll;
013    
014            public CollectionIterator(Key[] keys, Collection coll) {
015                    this.keys=new KeyIterator(keys);
016                    this.coll=coll;
017            }
018            public CollectionIterator(Iterator keys, Collection coll) {
019                    this.keys=keys;
020                    this.coll=coll;
021            }
022    
023            public boolean hasNext() {
024                    return keys.hasNext();
025            }
026    
027            /**
028             * @see java.util.Iterator#next()
029             */
030            public Object next() {
031                    return coll.get(KeyImpl.toKey(keys.next(),null),null);
032            }
033    
034            public void remove() {
035                    throw new UnsupportedOperationException("this operation is not suppored");
036            }
037    
038    }