de.fluxparticle.utils.chain.ChainIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of utils Show documentation
Show all versions of utils Show documentation
Some useful Java classes
The newest version!
package de.fluxparticle.utils.chain;
import java.util.Iterator;
/**
* Created by sreinck on 12.04.17.
*/
public class ChainIterator implements Iterator {
private Chain chain;
public ChainIterator(Chain chain) {
this.chain = chain;
}
@Override
public boolean hasNext() {
return !chain.isEmpty();
}
@Override
public T next() {
T head = chain.head();
chain = chain.tail();
return head;
}
public Chain getChain() {
return chain;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy