ru.yandex.bolts.collection.impl.UnmodifiableDefaultIteratorF Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bolts Show documentation
Show all versions of bolts Show documentation
Collections utilities used in various Yandex projects
The newest version!
package ru.yandex.bolts.collection.impl;
import java.util.Iterator;
import ru.yandex.bolts.collection.IteratorF;
import ru.yandex.bolts.collection.Unmodifiable;
public class UnmodifiableDefaultIteratorF extends DefaultIteratorF implements Unmodifiable {
protected UnmodifiableDefaultIteratorF(Iterator target) {
super(target);
}
public IteratorF unmodifiable() {
return this;
}
@Override
public void remove() {
throw new UnsupportedOperationException("immutable");
}
public static IteratorF wrap(Iterator iterator) {
if (iterator instanceof IteratorF> && iterator instanceof Unmodifiable) return (IteratorF) iterator;
else return new UnmodifiableDefaultIteratorF<>(iterator);
}
} //~