apoc.coll.SetBackedList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apoc-common Show documentation
Show all versions of apoc-common Show documentation
Data types package for Neo4j Procedures
package apoc.coll;
import java.util.*;
/**
* @author mh
* @since 10.04.16
*/
public class SetBackedList extends AbstractSequentialList implements Set {
private final Set set;
public SetBackedList(Set set) {
this.set = set;
}
@Override
public int size() {
return set.size();
}
public ListIterator listIterator(int index) {
return new ListIterator() {
Iterator it = set.iterator();
T current = null;
int idx = 0;
{
moveTo(index);
}
@Override
public boolean hasNext() {
return it.hasNext();
}
@Override
public T next() {
idx++;
return current = it.next();
}
@Override
public boolean hasPrevious() {
return idx > 0;
}
@Override
public T previous() {
if (!hasPrevious()) throw new NoSuchElementException();
T tmp = current;
moveTo(idx-1);
return tmp;
}
private void moveTo(int pos) {
Iterator it2 = set.iterator();
T value = null;
int i=0; while (i++ spliterator() {
return set.spliterator();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy