-
-
Notifications
You must be signed in to change notification settings - Fork 631
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
In-order access to LinkedHashMap keys #1850
Comments
We can't change @Override
public Set<K> keySet() {
return new LinkedHashSet(this);
} This would keep order of elements |
That's why I suggested adding To do that, though, wouldn't you also need to change the |
Oh, sorry :)
Yes, wrapped map should be changed to private final LinkedHashMap<T, Object> map; |
|
Fixed with #1854 |
Presumably for reasons of efficiency,
LinkedHashMap.keySet()
returns the unorderedkeySet
of the underlyingHashMap
. It would be convenient to be able to get the keys in order without having to resort to a workaround likemap.iterator().map(entry -> entry._1)
, even if the underlying implementation isn't any less ugly than that. E.g.(Forgive me if there's a more idiomatic way to do this; I have some Scala background but I've been stuck in Ruby for a year or two, and my Java and Javaslang are both rusty.)
The text was updated successfully, but these errors were encountered: