GraphComparator could not find the new member of ArrayList
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start by reproducing the provided ArrayList example and inspect GraphComparator.compare with the supplied getIdFetcher in both argument orders. The work is done when the reverse comparison reports the element added to the list, while preserving the existing OBJECT_ORPHAN behavior.
Written by the indexing model from the issue text.
Description
I am having a problem while using your great library as I want to compare two ArrayLists for differences using GraphComparator. I deleted an element of one of the lists and when I compared the old list and new list it shows that there is OBJECT_ORPHAN command. But when I reversed it by comparing the new list and the old list, it should show that there is a new object but somehow it could not detect.
My code is like this:
List<UnifiedBucket> ubs= new ArrayList<>(); // Assume I already put elements in the list
List<UnifiedBucket> ubsCopy = cloner.deepClone(ubs);
ubsCopy.remove(25);
ubsCopy.get(14).setRawPolicy(null);
List<GraphComparator.Delta> deltas = GraphComparator.compare(ubs, ubsCopy, getIdFetcher()); //This works fine as I could find the OBJECT_ORPHAN
for (GraphComparator.Delta delta : deltas) {
if (delta.getCmd() != GraphComparator.Delta.Command.LIST_SET_ELEMENT) {
System.out.println(delta);
}
}
List<GraphComparator.Delta> deltas2 = GraphComparator.compare(ubsCopy, ubs, getIdFetcher()); //This does not work fine as I could not find the new element that is not deleted in the ubs list
for (GraphComparator.Delta delta : deltas2) {
if (delta.getCmd() != GraphComparator.Delta.Command.LIST_SET_ELEMENT) {
System.out.println(delta);
}
}
Any reason why?
- Dominant language
- Java
- Stars
- 442
- Forks
- 115
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jdereg/java-util
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in jdereg/java-util
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100