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

enhance checked collections to take a Predicate, not just a type

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P5
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      Enhance the checked collections wrapper to take a Predicate that checks the validity of every element as its inserted, based on some logical condition of the predicate, as opposed to passing a Class<?> and having the only check be an instanceof check. The old type-checked collection wrapper could be rewritten as a special case of a general checked collections wrapper.

      This has also been referred to as a "validated" or "mediated" collections wrapper.

        Activity

        Hide
        smarks Stuart Marks added a comment -
        "This might allow us to merge the implementations of checked wrappers and immutable wrappers, where the immutable wrapper simply uses a very grumpy checking predicate." -- Brian Goetz

        Show
        smarks Stuart Marks added a comment - "This might allow us to merge the implementations of checked wrappers and immutable wrappers, where the immutable wrapper simply uses a very grumpy checking predicate." -- Brian Goetz

          People

          • Assignee:
            Unassigned
            Reporter:
            smarks Stuart Marks
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: