Pushing a branch for adding the IndexedLinkedList.#664
Pushing a branch for adding the IndexedLinkedList.#664coderodde wants to merge 5 commits intoapache:masterfrom
Conversation
There was a problem hiding this comment.
Hello @coderodde
PRs should not include IDE metadata. I've added these NetBean files to the /.gitignore file. If you rebase this PR on git master, these two files will be removed from the PR (but remain locally for you).
| <artifactId>jmh-core</artifactId> | ||
| <version>${commons.jmh.version}</version> | ||
| <scope>test</scope> | ||
| <version>1.37</version> |
|
|
||
| /** | ||
| * | ||
| * @author Rodion "rodde" Efremov |
There was a problem hiding this comment.
Remove author and version tags. since tags are only needed for new public and protected elements under main.
There was a problem hiding this comment.
Hello @coderodde
The build fails because the new tests don't cover all of the new code. To see the code coverage, you can run mvn clean verify site and look at the JaCoCo report in the generated report in target/site/jacoco/index.html
|
Hello, @garydgregory Are these correct instructions for rebasing the NetBeans related files: https://chatgpt.com/s/t_693544c351308191a5467b6d20d0f856 ? |
|
It would be great if the new data structure did not require pulling all the other commons-collections dependencies. |
Hello @coderodde Thank you for your updates. Unless you know git, you should go with a known and trusted source, for example:
HTH |
| * in benchmarking the actual {@code TreeList} against the | ||
| * {@link IndexedLinkedList}. | ||
| */ | ||
| public class ExtendedTreeList<E> extends TreeList<E> { |
There was a problem hiding this comment.
Hello @coderodde,
This class doesn't belong in main. Why is this needed at all?
There was a problem hiding this comment.
Hello @garydgregory ,
I had to roll ExtendedTreeList in order to provide such methods as getFirst() and friends for the actual JMH benchmark. Shall I remove it from the PR?
There was a problem hiding this comment.
Hello @coderodde
Thank you for your quick reply.
I think I see what's happening here: java.util.LinkedList<E> implements Deque<E> but org.apache.commons.collections4.list.TreeList<E> doesn't. It looks like ExtendedTreeList implements Deque methods but doesn't actually implement the interface with an implements Deque<E> in the code. Then I see IndexedLinkedList implements Deque. So we have a bit of a mismatch.
So:
- It's good that
IndexedLinkedListimplementsDeque<E> - It's not good that
ExtendedTreeListdoesn't
If all of that makes sense and you agree, do you think that org.apache.commons.collections4.list.TreeList<E> should implement Deque<E> first, then ExtendedTreeList would become superflous.
If you agree, you can create a PR that causes org.apache.commons.collections4.list.TreeList<E> to implement Deque<E>, with tests 😉
Another wrinkle is that IndexedLinkedList doesn't fit in the JRE's collection framework by extending java.util.AbstractSequentialList<E> or java.util.AbstractList<E>. Is there a reason to not fit it in?
Thank. you!
| public class IndexedLinkedList<E> implements Deque<E>, | ||
| List<E>, | ||
| Cloneable, | ||
| java.io.Serializable { |
There was a problem hiding this comment.
No need for a fully qualified name java.io.Serializable -> Serializable.
garydgregory
left a comment
There was a problem hiding this comment.
Hello @coderodde
Thank you for your update and for working through my questions and comments 😄
Is the intent to replace TreeList with your new implementation? We don't want 2 implementations of the same kind of class. It seems so to me, let me know.
If so, and the purpose of this PR, move ILL to the jmh package and call it TreeListNew. Then, if the new code proves better, we can just replace the old with the new in a secondary step.
Also, the TreeList Javadoc makes claims compared to ArrayList and LinkedList. I don't see JMH tests to support these claims, unfortunately. We don't want a new implementation to be worse compared to these existing claims.
Do you see an improvement or degradation there?
Thank you!
This PR contains:
Limitations so far: