I wrote my own container class for my game, similar to that of an ArrayList however different in quite a few ways, anyhow I want to write a foreach method that will iterate over the backing array.
I know that I could just use Arrays.stream
however I'm curious as to how it would look to write a custom lambda implementation of the #foreach method for iteration over an array.
Anybody have a clue? Thanks
Example:
class Container<T> {
T[] array = new T[200];
}
Now for instance lets say I wanted to do this:
Container<Fish> fishies = new Container();
fishies.forEach(fish->System::out);