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

HashTrieSet should never have a single entry #6197

Closed
scabug opened this issue Aug 6, 2012 · 3 comments
Closed

HashTrieSet should never have a single entry #6197

scabug opened this issue Aug 6, 2012 · 3 comments

Comments

@scabug
Copy link

scabug commented Aug 6, 2012

A set with one element should not be represented by HashSet.HashTrieSet, but by HashSet.HashSet1.

In the example below, y should be an instance of HashSet1 instead of HashTrieSet. A HashTrieSet with one element is redundant.

val x = HashSet(1,2)
val y = x - 1
println(y + " " + y.getClass)

// Set(2) class scala.collection.immutable.HashSet$HashTrieSet

@scabug
Copy link
Author

scabug commented Aug 6, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6197?orig=1
Reporter: @rklaehn
Affected Versions: 2.10.0-M6
See #6198

@scabug
Copy link
Author

scabug commented Aug 9, 2012

@rklaehn said:
It is OK and even sometimes necessary for a HashTrieSet to have one entry if the entry is a HashTrieSet itself. But if the entry is a HashSet1 or a HashSetCollision1 it should be prevented.

@scabug
Copy link
Author

scabug commented Aug 14, 2012

@axel22 said (edited on Aug 14, 2012 11:14:06 AM UTC):
What do you know - this was reported on my birthday. Must be destiny. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants