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
Mutable Queue only has expensive batch enqueue (elems: A*) #9175
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9175?orig=1 |
@VladUreche said: |
@Ichoran said: |
@ruippeixotog said: def enqueue[B >: A](elem: B): Unit
@deprecated(...) def enqueue[B >: A](elem: B, elem2: B, elems: B*): Unit
def enqueue[B >: A](iter: Iterable[B]): Unit Unless I'm not missing some corner case, that would keep source compatibility and pave the path to an unified API for enqueuing in 2.13 - a single-element enqueue and an iterator enqueue. |
@Ichoran said: |
@ruippeixotog said: |
@scala/collections what's the status on this one — should this stay open? |
fixed in 2.13 |
Seems
mutable.Queue
only has batch enqueuing:http://www.scala-lang.org/api/current/index.html#scala.collection.mutable.Queue@enqueue%28elems:A*%29:Unit
which tends to be slower than a combination of two enqueues, one for a single element and one for batches:
http://www.scala-lang.org/api/current/index.html#scala.collection.immutable.Queue@enqueue%5BB%3E:A%5D%28iter:scala.collection.immutable.Iterable%5BB%5D%29:scala.collection.immutable.Queue%5BB%5D
http://www.scala-lang.org/api/current/index.html#scala.collection.immutable.Queue@enqueue%5BB%3E:A%5D%28elem:B%29:scala.collection.immutable.Queue%5BB%5D
How do you feel about adding an enqueue to the mutable Queue?
The text was updated successfully, but these errors were encountered: