Skip to content
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

Added remove to ArrayList #1219

Closed
wants to merge 8 commits into from
Closed

Added remove to ArrayList #1219

wants to merge 8 commits into from

Conversation

tgschultz
Copy link
Contributor

remove replaces the specified list index with the value at the end of the list and returns the old value.

@jayschwa
Copy link
Sponsor Contributor

This implementation is nice because it's O(1), but I suspect that changing element order will surprise most people. I think the majority of other languages use a O(n) implementation for their "array list" / "vector" so that order is preserved.

@tiehuis
Copy link
Member

tiehuis commented Jul 14, 2018

For example, this is named swap_remove in Rust. Maybe just rename the function to show what it is doing more clearly.

@andrewrk
Copy link
Member

merged: 2a719ee

thanks!

@andrewrk andrewrk closed this Jul 14, 2018
@tgschultz tgschultz deleted the arraylist-remove branch October 23, 2018 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants