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

scala.collection.immutable.LongMap should have firstKey and lastKey to be consistent with IntMap

    Details

      Description

      IntMap and LongMap are completely similar except for the fact that LongMap does not have firstKey and lastKey. I am not sure if these collections are going to stay in the collections library in the long run, but if so it would be very helpful to add firstKey and lastKey to LongMap (just copy the code from IntMap).

      I need this to check if a collection is continuous (c.lastKey-c.firstKey+1 == c.size), because that allows me to do some optimizations. I know I could use c.keys.head and c.keys.last, but that is very inefficient since c.keys.last requires a full traversal of the collection.

        Activity

        Hide
        Michael Thorpe added a comment -
        Show
        Michael Thorpe added a comment - Pull request https://github.com/scala/scala/pull/1950
        Hide
        Paul Phillips added a comment -

        ce32c1a

        Show
        Paul Phillips added a comment - ce32c1a

          People

          • Assignee:
            Michael Thorpe
            Reporter:
            Rüdiger Klaehn
          • Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development