ReadOnlyIterator.java

db/src/net/sourceforge/pain/util/ReadOnlyIterator.java · 628 B

From the archive pain_0_45.tgz

Download the archive   « Back to the archive contents

package net.sourceforge.pain.util;

import java.util.*;

/**
 * Wrapper Iterator.
 * Disallows remove operation.
 * User: fmike  Date: Mar 6, 2004  Time: 3:04:37 AM
 */
public final class ReadOnlyIterator implements Iterator {
        private final Iterator it;

        public ReadOnlyIterator(Iterator it) {
            this.it = it;
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }

        public boolean hasNext() {
            return it.hasNext();
        }

        public Object next() {
            return it.next();
        }
    }

Site Stats

Snippets: 1791
Codebases: 571