I have a code which is as follows:
Arrays.stream(myArray).forEach(item -> System.out.println(item));
Does streams in Java have any ability of getting the index of the current item that I can use them inside the lambda expression?
For example in JavaScript we have this kind of code which can give us the index:
myArray.forEach((index, item) => console.log(`${index} ${item}`));
Do we have any equivalent in Java?