jdk/src/share/classes/java/util/Spliterator.java
changeset 17920 eef25bc37ccd
parent 17694 31d23e077ab3
child 18796 486b43748d9b
equal deleted inserted replaced
17919:b5c4ce8b74c5 17920:eef25bc37ccd
   392 
   392 
   393     /**
   393     /**
   394      * Convenience method that returns {@link #estimateSize()} if this
   394      * Convenience method that returns {@link #estimateSize()} if this
   395      * Spliterator is {@link #SIZED}, else {@code -1}.
   395      * Spliterator is {@link #SIZED}, else {@code -1}.
   396      * @implSpec
   396      * @implSpec
   397      * The default returns the result of {@code estimateSize()} if the
   397      * The default implementation returns the result of {@code estimateSize()}
   398      * Spliterator reports a characteristic of {@code SIZED}, and {@code -1}
   398      * if the Spliterator reports a characteristic of {@code SIZED}, and
   399      * otherwise.
   399      * {@code -1} otherwise.
   400      *
   400      *
   401      * @return the exact size, if known, else {@code -1}.
   401      * @return the exact size, if known, else {@code -1}.
   402      */
   402      */
   403     default long getExactSizeIfKnown() {
   403     default long getExactSizeIfKnown() {
   404         return (characteristics() & SIZED) == 0 ? -1L : estimateSize();
   404         return (characteristics() & SIZED) == 0 ? -1L : estimateSize();