Answers for "push data in list from front java"

1

java append to arraylist at beginning

ArrayList<Integer> arr = new ArrayList<Integer>();

arr.add(1);
arr.add(2);
arr.add(3);
arr.add(4);

int element = 0;

//ArrayList.add(index, element)
arr.add(0, element);
Posted by: Guest on January-05-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language