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

a little more effective implementation of methods removeAll() and retainAll()

    XMLWordPrintable

    Details

      Description

      A DESCRIPTION OF THE PROBLEM :
      In implementation of methods removeAll(Collection<?> c) and retainAll(Collection<?> c) for class AbstractCollection (and its child that override these methods) can be added checking the references equality with getting collection c. For removeAll(Collection<?> c), if references are equal, will be called method clear(), and returned true, if collection wasn't empty before clearing; for retainAll(Collection<?> c), if references are equal, will be returned true, if collection wasn't empty. I think that these optimization is useful for big size collection (skipping iteration).


        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: