📜  arraylist 添加新元素到末尾 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:06.714000             🧑  作者: Mango

代码示例1
//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();