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
scala.collection.generic.Sorted needs a nextKey() method #6642
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6642?orig=1 |
Jamie Allen (shinolajla) said: |
@retronym said: Demoted to Major on your behalf. |
@JamesIry said: |
@JamesIry said: There are well known ways to create navigable views over such structures but they all involve allocations. So when I say efficient I don't mean free from allocations. Is it possible you'd be better off with an entirely different data structure? |
@JamesIry said: |
@JamesIry said: |
@JamesIry said: |
We should be able to query the
nextKey: Option[T]
from a TreeMap[T, U] that is using the Sorted[T] interface. We also think the firstKey and lastKey implementations should not throw a NoSuchElementException but return Option[T] as well. We do not want to create a new iterator (such as keySet would do) or a new collection (as dropWhile would do).Seems to me like this would be implemented with some kind of pointer to "currentKey" in the collection. Which worries me because now we'd have to pay attention to concurrency issues.
The text was updated successfully, but these errors were encountered: