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

Distinct operation on an unordered stream should not be a barrier

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • core-libs

      A pipeline such as:

        ThreadLocalRandom.current().ints().boxed().parallel().distinct().findAny();

      will not terminate since distinct() is a barrier for an unordered input.

      In such cases it is possible for the distinct operation to be lazy and use a distinct wrapping spliterator, which internally uses a ConcurrentHashMap to track distinct elements.

            psandoz Paul Sandoz
            psandoz Paul Sandoz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: