Java容器:
常用的容器为Tomcat,weblogic。
java内部的容器类有:
List,ArrayList,Vector,以及Map,HashMap,和hashTable,以及HashSet
//代码如下
public class CollectionAll {
//Collection是容器层次中的根接口
public static void main(String[] args){
Lists();
Sets();
Maps();
}
private static void Lists(){
List a1=new ArrayList<>();
a1.add(“list”);
a1.add(“java”);
a1.add(“php”);
a1.add(“python”);
a1.add(“sql”);
System.out.println(“输出a1的值”+a1);
List<String> a2=new LinkedList<>();
}
private static void Sets(){
Set h1=new HashSet<String>();
h1.add("set集合");
h1.add("setpython");
h1.add("javaSet");
h1.add("php");
System.out.println("输出Set对应的值"+h1);
}
private static void Maps(){
Map<String,String> map=new HashMap<>();
map.put("1","value1");
map.put("2","value2");
map.put("3","value3");
map.put("4","value4");
for(String ma:map.keySet()){
System.out.println("输出key的值"+ma+"输出key对应的value的值"+map.get(ma));
}
}