package com.wangg;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

public class Dome01 {
public static void main(String[] args) {
Collection collection = new ArrayList();
collection.add(18);
collection.add(15);
collection.add(666);
collection.add("王刚");
System.out.println(collection);
List list= Arrays.asList(new Integer[]{15, 16, 17, 18, 19});
collection.addAll(list);
System.out.println(collection);
//collection.clear();//删除集合所有元素
System.out.println(collection);
System.out.println("集合的数量为:"+collection.size());
System.out.println("集合是否为空:"+collection.isEmpty());
boolean isr = collection.remove(19);//删除集合指定数据
System.out.println(collection);
System.out.println("集合数据是否删除:"+isr);
Collection collection1 = new ArrayList();
collection1.add(18);
collection1.add(15);
collection1.add(666);
collection1.add("王刚");
Collection collection2 = new ArrayList();
collection2.add(18);
collection2.add(15);
collection2.add(666);
collection2.add("王刚");
System.out.println(collection1.equals(collection2));//equals是比较是否一样
System.out.println(collection1==collection2);//比较大小比较的是地址,所以不一样
System.out.println(collection1.contains(666));//contains是否包含


}
}