Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aleksandra Pankratova #44

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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()).

}

@Override
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.

}

@Override
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