indexbasedbidirectionaliterator.java
来自「java 的源代码」· Java 代码 · 共 53 行
JAVA
53 行
package com.reddragon2046.base.utilities.data.collections;
import java.util.NoSuchElementException;
// Referenced classes of package com.reddragon2046.base.utilities.data.collections:
// IndexBasedForwardIterator, AbstractIndexBasedIterator, AbstractIteratorAdapter, IterationState
class IndexBasedBidirectionalIterator extends IndexBasedForwardIterator
{
public IndexBasedBidirectionalIterator(IterationState state)
{
super(state);
}
public boolean hasPrevious()
{
return !atBegin();
}
public Object previous()
{
if(!atBegin())
{
retreat();
return get();
} else
{
throw new NoSuchElementException();
}
}
public void add(Object obj)
{
throw new UnsupportedOperationException();
}
public int nextIndex()
{
return getInternalIndex() + 1;
}
public int previousIndex()
{
return getInternalIndex() - 1;
}
public void set(Object obj)
{
throw new UnsupportedOperationException();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?