I'm reading effective java and have one question. I don't understand why the stream iterator returns to Iterable. As I know, The Iterable contains the Iterator Interface. But in stream api, this code is working, even though iterator doesn't inherit the Iterable.
public static <E> Iterable<E> iterableOf(Stream<E> stream){
return stream::iterator;
}
I'm very confusing about this codes. Because there is no relation between Iterator and Iterable, excepting for that Iterable has Iterator.