I am just practising java.
I have this ArrayList which contains duplicate values.
I want to loop through this list so that it can print these duplicate values by group.
here is what my method contains.
ArrayList nomero = new ArrayList();
nomero.add(1);
nomero.add(1);
nomero.add(2);
nomero.add(2);
nomero.add(3);
nomero.add(3);
for(int i=0; i<nomero.size(); i++){
System.out.println(nomero.get(i));
}
and the it prints like below.
what I wanna do is print it like
Please help me with this issue. Thanks.


if value != lastValue print new lineso basically you need to know the last "group" value and when it changes, you print a new line