fast tooth
fast tooth

Reputation: 2459

Java.util.Collection overrides spliterator()

In the source code of Collection<E>, I am wondering why the @Override annotation is used. The spliterator() method doesn't come from Iterable<E>, and Object doesn't have it either.

public interface Collection<E> extends Iterable<E> {
    @Override
    default java.util.Spliterator<E> spliterator() {
        return java.util.Spliterators.spliterator(this, 0);
    }

Upvotes: 0

Views: 136

Answers (1)

Zielu
Zielu

Reputation: 8552

Iterable DOES HAVE spliterator. Check javadoc for java8 not the previous ones

Upvotes: 2

Related Questions