I have a arraylist of type integer. The list contains some values.
At some point the list will contain similar values consecutively (3 values).
I need to find the position at which the 3 similar elements appear.
For example:
ArrayList<Integer> int_values=new ArrayList<Integer>();
int_values.add(10);
int_values.add(20);
int_values.add(30);
int_values.add(10);
int_values.add(10);
int_values.add(10);
As can be seen from position 3 to 5 there are similar values.
So I need to retrieve the position 5.
Also this series of similar elements repeating will occur only once.
I hope I am able to explain the scenario.
You can do as below,