I am new to Java, so please accept my apology. I have an ordered array-list i.e. { 10, 10, 10, 10, 120, 120 }
.
How can I loop through the list to check the int 10
are placed at the top of the list and int 120
are placed at the bottom of the list?
I tried using
for(int i=0; i<list.size(); i++){
for(int j=0; j<list.size(); j++){
}
}
but that's how far I could get / understand.