ArrayList和HashMap常见用法

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;


public class Test {
    public static void main(String[] args) {

        ArrayList<String> task = new ArrayList<String>();
        task.add("F14");
        task.add("F15");
        task.add("F16");
        for(String s : task){
            System.out.println(s);
        }


        HashMap<String,String> taskss = new HashMap<String,String>();
        taskss.put("张三", "30");
        taskss.put("张三1", "301");
        taskss.put("张三2", "302");
        Set<String> keys = taskss.keySet();
        for(String key : keys){
            String value = taskss.get(key);
            System.out.println(key+":"+value);
        }

    }
}

你可能感兴趣的:(集合)