Answers for "add arraylist to end of arraylist"

1

arraylist add new element to end

//add to the end of the list
    stringList.add(random);

    //add to the beginning of the list
    stringList.add(0,  random);

    //replace the element at index 4 with random
    stringList.set(4, random);

    //remove the element at index 5
    stringList.remove(5);

    //remove all elements from the list
    stringList.clear();
Posted by: Guest on April-22-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language