how to romve a element from arraylist in java

Solutions on MaxInterview for how to romve a element from arraylist in java by the best coders in the world

showing results for - "how to romve a element from arraylist in java"
Filippo
30 Jun 2016
1        List<Integer> al = new ArrayList<>();
2
3        al.add(10);
4        al.add(20);
5        al.add(30);
6        al.add(1);
7        al.add(2);
8// This makes a call to remove(index) and 
9// removes element 20.
10        al.remove(1);        
11// Now element 30 is moved one position back
12// So element 30 is removed this time
13        al.remove(1);