public class ListAPIDemo {
public static void main(String[] args){
ArrayList list = new ArrayList();
System.out.println(list.size());//0
System.out.println(list.isEmpty());//true
list.add("忐忑");
list.add("Poker Face");
list.add(0, "春天里");
System.out.println(list.size());
//3
System.out.println(list.isEmpty());
//false
list.remove(1);
System.out.println(list); /
/[春天里, poker Face]
String name = (String) list.set(0, "菊花台");
System.out.println(name);
春天里 为什么不是菊花台
System.out.println(list.get(0));//
int index = list.indexOf("Poker Face");
System.out.println(index);
//1
System.out.println(list.contains("春天里"));
//false
}
}