ArrayDeque throws exceptions in a variety of cases when empty when there is a very sensible behavior instead. For instance,
scala> val xs = strawman.collection.mutable.Queue.empty[Int]
xs: strawman.collection.mutable.Queue[Int] = ArrayDeque()
scala> xs.toArray
java.lang.IndexOutOfBoundsException: 0
at strawman.collection.mutable.ArrayDeque.requireBounds(ArrayDeque.scala:487)
at strawman.collection.mutable.ArrayDeque.copySliceToArray(ArrayDeque.scala:447)
at strawman.collection.mutable.ArrayDeque.toArray(ArrayDeque.scala:434)
... 40 elided
scala> xs.insert(0, 0)
java.lang.IndexOutOfBoundsException: 0
at strawman.collection.mutable.ArrayDeque.requireBounds(ArrayDeque.scala:487)
at strawman.collection.mutable.ArrayDeque.insert(ArrayDeque.scala:132)
... 40 elided
There are also problems with copyToArray and patchInPlace. These issues make it impossible to test ArrayDeque (and thus mutable.Queue) properly with collections-laws, so there are likely other undiscovered bugs as well.
ArrayDeque
throws exceptions in a variety of cases when empty when there is a very sensible behavior instead. For instance,There are also problems with
copyToArray
andpatchInPlace
. These issues make it impossible to testArrayDeque
(and thusmutable.Queue
) properly with collections-laws, so there are likely other undiscovered bugs as well.