Skip to content

Conversation

HackuunaMatata
Copy link

No description provided.

// TODO
throw new UnsupportedOperationException();
inner.forEachRemaining((Double d) -> {
action.accept(new IndexedDoublePair(currentIndex, d));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect. Add test with collect(toList()).

public int characteristics() {
// TODO
throw new UnsupportedOperationException();
return inner.characteristics();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect. See documentation for SORTED.

public void forEachRemaining(Consumer<? super Pair<A, B>> action) {
// TODO
throw new UnsupportedOperationException();
inner.forEachRemaining(a -> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect. Add test with array shorter than spliterator.

Spliterator<A> split = inner.trySplit();
if (split == null) return null;
final ZipWithArraySpliterator<A, B> spliterator = new ZipWithArraySpliterator<>(split, array);
spliterator.setIndex(index);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use constructor parameter.

if (split == null) return null;
final ZipWithArraySpliterator<A, B> spliterator = new ZipWithArraySpliterator<>(split, array);
spliterator.setIndex(index);
index = Math.min((int) (index + split.estimateSize()), array.length);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary. index + split.estimateSize() works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants