iterator() method API
Posted: Wed Jan 03, 2018 3:50 pm
iterator() is listed as both instance method and abstract method of interface Iterable, like this:
Iterator<T> iterator()
Returns an iterator over elements of type T.
Returns:an Iterator
Under Abstract Method and Instance Method.
I thought an interface has 3 type of methods: default method, static method and abstract method; so my question is why is iterator() is a instance method under Iterable API ?
Iterator<T> iterator()
Returns an iterator over elements of type T.
Returns:an Iterator
Under Abstract Method and Instance Method.
I thought an interface has 3 type of methods: default method, static method and abstract method; so my question is why is iterator() is a instance method under Iterable API ?