Is there a way to use the augmented for loop to traverse through an array where the index is also required.
For example suppose I want to traverse an array of integers and add each number along with its index to a Map. My code will be something like
Map<Integer, Integer> map = new HashMap<>();
        for(int i=0; i< numbers.length; i++){
            map.put(numbers[i], i);
        }
Is there a way to write this using the for-each loop.