How do I update the element at a certain position in an ArrayList? [duplicate]
问题 This question already has answers here : Java ArrayList replace at specific index (5 answers) Closed last year . I have one ArrayList of 10 String s. How do I update the index 5 with another String value? 回答1: Let arrList be the ArrayList and newValue the new String , then just do: arrList.set(5, newValue); This can be found in the java api reference here. 回答2: list.set(5,"newString"); Reference 回答3: arrList.set(5,newValue); and if u want to update it then add this line also youradapater