garydgregory commented on code in PR #664:
URL: 
https://github.com/apache/commons-collections/pull/664#discussion_r2596266689


##########
src/main/java/org/apache/commons/collections4/list/IndexedLinkedList.java:
##########
@@ -0,0 +1,5706 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.list;
+
+import java.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.ConcurrentModificationException;
+import java.util.Deque;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.Random;
+import java.util.Set;
+import java.util.Spliterator;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
+
+/**
+ * <p>
+ * This class implements the indexed, heuristic doubly-linked list data 
+ * structure that runs all the single-element operations in expected
+ * \(\mathcal{O}(\sqrt{n})\) time. Under the hood, the actual elements are
+ * stored in a doubly-linked list. However, we also maintain a list of 
so-called 
+ * <i>"fingers"</i> stored in a random access array. Each finger {@code F} 
+ * contains two data fields:
+ * <ul>
+ *  <li>{@code F.node} - the actual element node,</li>
+ *  <li>{@code F.index} - the appearance index of {@code F.node} in the actual 
+ *       list.</li>
+ * </ul>
+ * 
+ * <p>
+ * 
+ * For the list of size \(n\), we maintain 
+ * \(\bigg \lceil \sqrt{n} \bigg \rceil + 1\) fingers. The rightmost finger in 
+ * the finger list is a <i>special end-of-list sentinel</i>. It always has 
+ * {@code F.node = null} and {@code F.index = } \(n\). The fingers are sorted 
by 
+ * their indices. That arrangement allows simpler and faster code in the 
method 
+ * that accesses a finger via element index; see 
+ * {@link FingerList#getFingerIndexImpl(int)}. Since number of fingers is 
+ * \(\sqrt{n}\), and assuming that the fingers are evenly distributed, each 
+ * finger "covers" \(n / \sqrt{n} = \sqrt{n}\) elements. In order to access an 
+ * element in the actual list, we first consult the finger list for the index 
+ * {@code i} of the finger {@code fingerArray[i]} that is closest to the index 
+ * of the target element. This runs in 
+ * 
+ * \[ 
+ * \mathcal{O}(\log \sqrt{n}) = \mathcal{O}(\log n^{1/2}) = 
\mathcal{O}(\frac{1}{2} \log n) = \mathcal{O}(\log n).
+ * \]
+ * 
+ * The rest is to <i>"rewind"</i> the closest finger to point to the target 
+ * element (which requires \(\mathcal{O}(\sqrt{n})\) on evenly distributed 
+ * finger lis). 
+ * 
+ * @param <E> the element type.
+ */
+public class IndexedLinkedList<E> implements Deque<E>, 
+                                             List<E>, 
+                                             Cloneable, 
+                                             java.io.Serializable {

Review Comment:
   No need for a fully qualified name `java.io.Serializable` -> `Serializable`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to