Scala Programming Language
  1. Scala Programming Language
  2. SI-6981

s.c.i.Queue's enqueue method takes s.c.i.Iterable instead of s.c.Iterable

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: Scala 2.10.0
    • Fix Version/s: None
    • Component/s: Collections
    • Labels:

      Description

      One of the overloads on scala.collection.immutable.Queue's enqueue method takes a scala.collection.immutable.Iterable as argument, which can cause confusion because the Iterable imported through Predef is the scala.collection.Iterable. For example:

      scala> import collection.immutable.Queue
      import collection.immutable.Queue
      
      scala> val q: Queue[Int] = Queue(1,2,3)
      q: scala.collection.immutable.Queue[Int] = Queue(1, 2, 3)
      
      scala> q.enqueue(Iterable(4))
      res10: scala.collection.immutable.Queue[Any] = Queue(1, 2, 3, List(4))
      
      scala> q.enqueue(scala.collection.immutable.Iterable(4))
      res11: scala.collection.immutable.Queue[Int] = Queue(1, 2, 3, 4)
      

      Since there's no reason to require an immutable iterable, it should be made more generic.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Daniel Sobral
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development