diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyIterator.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyIterator.java | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyIterator.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyIterator.java deleted file mode 100644 index df0a51333d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyIterator.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.internal.iterators; - -import java.util.Collection; -import java.util.Iterator; -import org.eclipse.jpt.utility.internal.StringTools; - -/** - * A <code>ReadOnlyIterator</code> wraps another <code>Iterator</code> - * and removes support for #remove(). - */ -public class ReadOnlyIterator<E> - implements Iterator<E> -{ - private final Iterator<? extends E> nestedIterator; - - /** - * Construct an iterator on the specified collection that - * disallows removes. - */ - public ReadOnlyIterator(Collection<? extends E> c) { - this(c.iterator()); - } - - /** - * Construct an iterator with the specified nested iterator - * and disallow removes. - */ - public ReadOnlyIterator(Iterator<? extends E> nestedIterator) { - super(); - this.nestedIterator = nestedIterator; - } - - public boolean hasNext() { - // delegate to the nested iterator - return this.nestedIterator.hasNext(); - } - - public E next() { - // delegate to the nested iterator - return this.nestedIterator.next(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.nestedIterator); - } - -} |