list.set code example
Example 1: java set value of arraylist
import java.util.ArrayList;
public class SetExample {
public static void main(String args[]) {
ArrayList<Integer> arraylist = new ArrayList<Integer>();
arraylist.add(1);
System.out.println(arrayList.get(0));
//1
arrayList.set(0, 2)
System.out.println(arrayList.get(0));
//2
}
}
Example 2: list set python
myset = {"apple", "banana", "cherry"}
mylist = ["dog", "cat", "humanoid"]
mydict = {'planet': 'blue', 'edges': 4, 'perimeter':15}
Example 3: .set arraylist
Java arraylist set()