-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup strange code #2241
base: master
Are you sure you want to change the base?
Cleanup strange code #2241
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -332,8 +332,8 @@ private List<Geometry> createGeometries() throws IOException { | |
indexMap = new ArrayList<>(vCount); | ||
reverseVertexMap = new ArrayList<>(vCount); | ||
for(int i = 0; i < vCount; ++i) { | ||
vertexMap.set(i, i); | ||
indexMap.set(i, i); | ||
vertexMap.add(i, i); | ||
indexMap.add(i, i); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be reverted back to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The set method does replace one element of the collection with another. However, if an element with the given index does not exist, the method will generate an IndexOutOfBoundExeption error. In the above code, the collection is created before the loop, so it will always be empty. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. technically add(index,v) is still wrong, the only reason it works is that it is executed in sequence from 0 to n, so i suggest to change it to vertexMap.add(i);
indexMap.add(i); without the index There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the vCount initializes the capacity, that is indeed the initial size of the internal array, however set will still fail because size() is not == capacity in arraylist . Kinda weird, but that's how it is, it would need a |
||
List<Integer> l = new ArrayList<>(1); | ||
l.add(i); | ||
reverseVertexMap.add(l); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method cannot be deleted, in order to maintain backwards compatibility.