arraylist java remove last element code example
Example 1: remove last element from arraylist java
ArrayList<Integer> list = new ArrayList<>();
list.add(1);
list.add(2);
list.add(3);
list.remove(list.size()-1); //removes 3
Example 2: java remove last array element
Arrays.copyOf(original, original.length-1)