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

enhance Stream.distinct() to allow customization of what is considered "distinct"

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • None
    • core-libs

      Currently Stream.distinct() keeps seen values in a Set which implicitly compares them for equality. It would be nice for the application to supply some other notion of equality than the object's built-in notion. This could be phrased as passing a Predicate<T,T> that is used to determine equality between two values of type T. An alternative would be to pass a Function<T,U> that maps each value into a different value that is then stored in the set and is tested for equality.

            smarks Stuart Marks
            smarks Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: