Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
import java.util.ArrayList as ArrayList
arr = ArrayList()
arr.add(10)
arr.add(20)
print "ArrayList:",arr
arr.remove(10) #remove 10 from arraylist
arr.add(0,5) #add 5 at 0th index
print "ArrayList:",arr
print "element at index 1:",arr.get(1) #retrieve item at index 1
arr.set(0,100) #set item at 0th index to 100
print "ArrayList:",arr
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more