标签:
//ArrayList实现接口 import java.util.*; public class TestList { public static void main(String[] args) { ArrayList<Integer> array = new ArrayList<Integer>(); for(int i=0;i<101;i++){ array.add(i); } System.out.println("原先的数据:\n"+array); list.remove(10); System.out.println("移除之后的数据:\n"+array); } } //HashSet实现接口 import java.util.*; public class TestSet { public static void main(String[] args) { ArrayList<String> array = new ArrayList<>(); List.add("A"); List.add("a"); List.add("c"); List.add("C"); List.add("a"); HashSet<String> hash = new HashSet<String>(); hash.addAll(array); for(String x:hash){ System.out.println(x); } } } //Map接口实现 import java.util.*; public class TestMap { public static void main(String[] args) { HashMap<String,String> map = new HashMap<String,String>(); HashMap<String,String> mvp = new HashMap<String,String>(); map.put("001","A"); map.put("002","B"); map.put("003","C"); map.put("004","D"); map.put("005","E"); map.put("006","F"); System.out.println(map); mvp.putAll(map); mvp.remove("005"); System.out.println(mvp); } }
标签:
原文地址:http://www.cnblogs.com/hellodp/p/5152645.html