diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 96cc43efa..46d39593e 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,22 +1,41 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 3e5d2de7a..12768205c 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,25 +2,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/router/java/src/net/i2p/router/util/CachedIteratorCollection.java b/router/java/src/net/i2p/router/util/CachedIteratorCollection.java
index 84570882d..6038dd67d 100644
--- a/router/java/src/net/i2p/router/util/CachedIteratorCollection.java
+++ b/router/java/src/net/i2p/router/util/CachedIteratorCollection.java
@@ -1,8 +1,4 @@
-// Extend `java.util.AbstractCollection` to create a collection that can be iterated over without creation of a new
-// object
-
-// https://docs.oracle.com/javase/7/docs/api/java/util/AbstractCollection.html
-
+// The Node class below is derived from Java's LinkedList.java
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,7 +23,6 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-// The Node class below is from Java's LinkedList.java
package net.i2p.router.util;
@@ -38,6 +33,14 @@ import java.util.NoSuchElementException;
import net.i2p.I2PAppContext;
import net.i2p.util.Log;
+/**
+ * Extend java.util.AbstractCollection to create a collection that can be
+ * iterated over without creation of a new object
+ *
+ * @since 0.9.36
+ *
+ */
+
public class CachedIteratorCollection extends AbstractCollection {
// FOR DEBUGGING & LOGGING PURPOSES
@@ -60,18 +63,18 @@ public class CachedIteratorCollection extends AbstractCollection {
Node next;
Node prev;
- Node(Node prev, E element, Node next) {
+ Node(Node prev, E element) {
this.item = element;
this.prev = prev;
- this.next = next;
+ this.next = null;
}
}
// First Node in the AbstractCollectionTest object
- private transient Node first;
+ private transient Node first = null;
// Last Node in the AbstractCollectionTest object
- private transient Node last;
+ private transient Node last = null;
/**
* Default constructor
@@ -85,14 +88,13 @@ public class CachedIteratorCollection extends AbstractCollection {
*/
@Override
public boolean add(E element) {
+ final Node newNode = new Node<>(null, element);
if (this.size == 0) {
- final Node newNode = new Node<>(null, element, null);
this.first = newNode;
this.last = newNode;
} else {
- final Node newLast = new Node<>(this.last, element, null);
- this.last.next = newLast;
- this.last = newLast;
+ this.last.next = newNode;
+ this.last = newNode;
}
this.size++;
log.debug("CachedIteratorAbstractCollection: Element added");
@@ -205,5 +207,7 @@ public class CachedIteratorCollection extends AbstractCollection {
/**
* Return size of current LinkedListTest object
*/
- public int size() { return this.size; }
+ public int size() {
+ return this.size;
+ }
}