In given list of Integers i want to find the multiple index of maximum value in List.
For example,
List<Integer> len=Arrays.asList(9,3,6,5,4,9);
Now i want to find the largest element which is 9 and its all index which are 0 and 5.
i have tried following code but it only gives me the first occurrence of element so from this code i am getting output only 0 not 5.
IntStream.range(0,len.size()).reduce((a, b) -> len.get(a) < len.get(b)?b:a).ifPresent(ix -> System.out.println("Index -"+ix));
So how can i achieve that ?