Menu

#44 Preserve order using a LinkedHashSet

open
nobody
None
5
2012-10-20
2012-10-20
No

In BasicMultiMap, entrySet() does a copy from the underlying LinkedHashSet's keySet() to a new Set<Entry<K, V>>. Because the copy is made to a HashSet rather than a LinkedHashSet, order is not preserved, which is annoying.

A workaround appears to be to iterate over BasicMultiMap.keySet() and then look up each value, but that should not be necessary.

This is significant when iterating over a Section's entries when order matters.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB