本文整理汇总了Java中com.google.common.collect.ForwardingIterator类的典型用法代码示例。如果您正苦于以下问题:Java ForwardingIterator类的具体用法?Java ForwardingIterator怎么用?Java ForwardingIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ForwardingIterator类属于com.google.common.collect包,在下文中一共展示了ForwardingIterator类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterator
import com.google.common.collect.ForwardingIterator; //导入依赖的package包/类
@Override
public Iterator<E> iterator() {
final Iterator<E> valueIterator = value.iterator();
return new ForwardingIterator<E>() {
@Override
protected Iterator<E> delegate() {
return valueIterator;
}
@Override
public void remove() {
super.remove();
change();
}
};
}
示例2: iterator
import com.google.common.collect.ForwardingIterator; //导入依赖的package包/类
@Override
public Iterator<E> iterator() {
final Iterator<E> delegateIterator = delegate().iterator();
return new ForwardingIterator<E>() {
@Override
protected Iterator<E> delegate() {
return delegateIterator;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
示例3: iterator
import com.google.common.collect.ForwardingIterator; //导入依赖的package包/类
@Override
public Iterator<E> iterator() {
final class ReadOnlyIterator extends AbstractIterator<E> {
Node<E> current = top.get();
@Override
protected E computeNext() {
for (;;) {
if (current == null) {
return endOfData();
}
E e = current.get();
current = current.next;
if (e != null) {
return e;
}
}
}
};
return new ForwardingIterator<E>() {
final ReadOnlyIterator delegate = new ReadOnlyIterator();
@Override
public void remove() {
checkState(delegate.current != null);
delegate.current.lazySet(null);
}
@Override
protected Iterator<E> delegate() {
return delegate;
}
};
}