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

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

XMLWordPrintable

      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).


            smarks Stuart Marks
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: