+ private class ListItr implements ListIterator<Resource> {
+
+ int index;
+ int max;
+
+ public ListItr(int index) {
+ this.index = index;
+ this.max = size();
+ }
+
+ @Override
+ public boolean hasNext() {
+ return index < max;
+ }
+
+ @Override
+ public Resource next() {
+ int i = index;
+ if (i >= max)
+ throw new NoSuchElementException();
+ int id = backend.getQuick(index);
+ index = i + 1;
+ return new ResourceImpl(session.resourceSupport, id);
+ }
+
+ @Override
+ public boolean hasPrevious() {
+ return index != 0;
+ }
+
+ @Override
+ public Resource previous() {
+ int i = index - 1;
+ if (i < 0)
+ throw new NoSuchElementException();
+ int id = backend.getQuick(index);
+ index = i;
+ return new ResourceImpl(session.resourceSupport, id);
+ }
+
+ @Override
+ public int nextIndex() {
+ return index;
+ }
+
+ @Override
+ public int previousIndex() {
+ return index - 1;
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException("remove not supported");
+ }
+
+ @Override
+ public void set(Resource e) {
+ throw new UnsupportedOperationException("set not supported");
+ }
+
+ @Override
+ public void add(Resource e) {
+ throw new UnsupportedOperationException("add not supported");
+ }
+ }
+