equal
deleted
inserted
replaced
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(); |