Skip to content

Aleksandra Pankratova#44

Open
HackuunaMatata wants to merge 3 commits intojava8-course:masterfrom
HackuunaMatata:master
Open

Aleksandra Pankratova#44
HackuunaMatata wants to merge 3 commits intojava8-course:masterfrom
HackuunaMatata:master

Conversation

@HackuunaMatata
Copy link
Copy Markdown

No description provided.

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

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();
Copy link
Copy Markdown

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 -> {
Copy link
Copy Markdown

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);
Copy link
Copy Markdown

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);
Copy link
Copy Markdown

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