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

Collections.emptySet().spliterator().hasCharacteristics(Spliterator.DISTINCT)) returns false

    XMLWordPrintable

Details

    Description

      JDK8 b93 specification on j.u.Set.spliterator()

      http://download.java.net/jdk8/docs/api/java/util/Set.html#spliterator()

      says:

      "The Spliterator reports [...] Spliterator.DISTINCT."


      this is not so for spliterator returned by method
      Collections.emptySet().spliterator()

      -----------------------------------------
      import java.util.Collections;
      import java.util.Spliterator;

      public class Bug {

          public static void main(String[] args) {
              System.out.println("distinct = " +
                      Collections.emptySet().spliterator().hasCharacteristics(Spliterator.DISTINCT));
          }
      }
      -----------------------------------------


      will print out:

      distinct = false

      The following JCK tests will fail due to this issue:

      api/java_util/Collections/empty/index.html#EmptySetSpliterator[hasCharacteristics_DISTINCT]
      api/java_util/Collections/empty/index.html#EmptySetSpliterator[characteristics_DISTINCT]
      api/java_util/Collections/empty/index.html#EMPTY_SETSpliterator[hasCharacteristics_DISTINCT]
      api/java_util/Collections/empty/index.html#EMPTY_SETSpliterator[characteristics_DISTINCT]                  

      Attachments

        Issue Links

          Activity

            People

              psandoz Paul Sandoz
              dbessono Dmitry Bessonov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: