Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
[jOOQ#311] fixed inconsistencies in SeqUtils.transform's Spliterator.…
Browse files Browse the repository at this point in the history
…characteristics()
  • Loading branch information
Tomasz Linkowski committed May 9, 2017
1 parent c3b3b45 commit 6e8eef8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/main/java/org/jooq/lambda/SeqUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,22 @@ public long estimateSize() {
return Long.MAX_VALUE;
}

/**
* This <code>Spliterator</code> always returns a subset of elements from the source <code>stream</code> so:
* - it cannot be <code>SIZED</code> nor <code>SUBSIZED</code> (some element may have been removed)
* - it is still <code>DISTINCT</code>, <code>NONNULL</code>, and <code>IMMUTABLE</code> (nothing added)
* - it is still <code>SORTED</code> (nothing reordered)
*
* Moreover:
* - we impose <code>ORDERED</code> because <code>Seq</code> is always ordered
* - we remove <code>CONCURRENT</code> because <code>Seq</code> is always sequential
*
* @see <a href="https://github.com/jOOQ/jOOL/issues/311">[#311]</a>
*/
@Override
public int characteristics() {
return delegate.characteristics() & Spliterator.ORDERED;
return (delegate.characteristics() | Spliterator.ORDERED)
& ~(Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.CONCURRENT);
}

@Override
Expand Down

0 comments on commit 6e8eef8

Please sign in to comment.