Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8221921

Implement size() / isEmpty() in immutable collections

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 13
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b16

      Description

      A few of the ImmutableCollections are inheriting size and/or isEmpty from abstract base classes. A few of these are inefficiently implemented, e.g., on a Map of one element isEmpty() will entrySet().size() == 0 when it could be implemented as "return false".

      Override such methods where it makes sense.

        Attachments

          Activity

            People

            • Assignee:
              redestad Claes Redestad
              Reporter:
              redestad Claes Redestad
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: