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

Collections doesNotContain convenience method

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      The Collection.contains method is obviously useful and readable for checking if an element exists within a collection.

      I think it would also be useful to have a Collection.doesNotContain method which is simply the opposite.
      I realise that this can be easily achieved with the not (!) operator on the existing method. However, I think it would be nice to have a native method that reads like plain English.

      There are several use cases where this kind of syntax would be preferable, such as checking a deny list for a provided value.


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

              Created:
              Updated:
              Resolved: