Question: provide a functional interface IntSequence with a single abstract method next that returns the next element from the sequence or nullif all elements have been
provide a functional interface IntSequence with a single abstract method next that returns the next element from the sequence or nullif all elements have been visited. Provide a static method fromIterator that turns an Iterator
default IntSequence alternate(IntSequence other)
that returns a sequence alternately taking elements from this and the other sequence, until both are exhausted. For example, if the first sequence returns values 1, 2, 4, 8, 11 and the second returns values 7, 5, 9, then you should return a sequence yielding 1, 7, 2, 5, 4, 9, 8, 11.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
