Skip to content

range methods on SortedSet / SortedMap #13

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

Merged
merged 6 commits into from
Apr 19, 2018
Merged

range methods on SortedSet / SortedMap #13

merged 6 commits into from
Apr 19, 2018

Conversation

lrytz
Copy link
Member

@lrytz lrytz commented Apr 18, 2018

No description provided.

@lrytz lrytz changed the title Sorted range range methods on SortedSet / SortedMap Apr 18, 2018
@lrytz lrytz requested a review from szeiger April 18, 2018 09:51
@lrytz
Copy link
Member Author

lrytz commented Apr 18, 2018

The test doesn't compile with 2.13.0-M4-pre-20d3c21, will update the version once scala/scala#6537 is merged.

lrytz added 2 commits April 18, 2018 14:54
This version includes the new `rangeTo` / `rangeFrom` / `rangeUntil`
methods.
@lrytz
Copy link
Member Author

lrytz commented Apr 18, 2018

Rebased, updated scala version, also added scala.collection.Factory. Needs another review :-)

def newBuilder(): mutable.Builder[A, C] = cbf()
def fromSpecific(it: TraversableOnce[A]): C = (cbf() ++= it).result()
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is already in src/main/scala-2.11_2.12/scala/collection/Factory.scala, no?

@lrytz
Copy link
Member Author

lrytz commented Apr 18, 2018

Ah, Factory was already added in the meantime :-) Removed my version

@@ -1,12 +1,10 @@
package collection
package scala.collection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially the tests were in the “empty” package. I moved them to the collection package just to not be in the empty package. However I’d rather not use the scala.collection package because it implicitly imports everything that is in that package, whereas user code doesn’t do that usually. I think we should put the tests in a dummy package just to reproduce the same context as in user code. (And that would solve the issue with BitSet shadowing)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll move them. What do you think about test.scala.collection....? Having them in _root_.collection looked like an oversight.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be good now.

val m3 = mp.rangeUntil(x)
assertEquals(m3: m.SortedMap[String, Int], mp.until(x))
}
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of using TreeMap instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no mutable.TreeMap in 2.11..

@lrytz lrytz merged commit 41243aa into scala:master Apr 19, 2018
@lrytz lrytz deleted the sortedRange branch April 26, 2018 17:33
martijnhoekstra pushed a commit to martijnhoekstra/scala-collection-compat that referenced this pull request Nov 9, 2022
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.

2 participants