zoukankan      html  css  js  c++  java
  • List Map迭代 ( 增强For只适合取数据 )

    @Test

    public void test1(){

      List list = new ArrayList();

      list.add(DateType);

      ...

      for(Object obj : list){

        DateType dateType = (DateType)obj;

      }

    }

    @Test

    public void test2(){

      Map map = new LinkedHashMap();

      map.add(StringValue,DateType);

      ...

      Set set = map.keySet();

      Iterator it = set.iterator();

      while(it.hasNext()){

        String key = (DateType)it.next();

        DateType value = (DateType)map.get(key);

      }

    }

    @Test

    public void test3(){

      Map map = new LinkedHashMap();

      map.add(StringValue,DateType);

      ...

      Set set = map.entrySet();

      Iterator it = set.iterator();

      while(it.hasNext()){

        Map.Entry entry = (Entry)it.next();

        String key = (String)entry.getKey();

        DateType value = (DateType)entry.getValue();

      }

    }

    @Test

    public void test4(){

      Map map = new LinkedHashMap();

      map.add(StringValue,DateType);

      ...

      for(Object obj : map.keySet()){

        String key = (String)obj;

        DateType value = (DateType)map.get(key);

      }

    }

    @Test

    public void test5(){

      Map map = new LinkedHashMap();

      map.add(StringValue,DateType);

      ...

      for(Object obj : map.entrySet()){

        Map.Entry entry = (Entry)obj;    

        String key = (String)entry.getKey();

        DateType value = (DateType)entry.getValue();

      }

    }

    @Test

    public void test6(){

      Map map = new LinkedHashMap();

      map.add(StringValue,DateType);

      ...

      for(Object obj : map.entrySet()){

        Map.Entry entry = (Entry)obj;    

        String key = (String)entry.getKey();

        DateType value = (DateType)entry.getValue();

      }

    }

  • 相关阅读:
    大作文-学以”成人”
    方案类--博物院整改意见
    归纳概括-我国中小学开展研学旅行活动的特点
    短文-网络新一代
    短评
    讲话稿-文明素养教育主题宣传
    检验用户单点登录方案解决
    Spring @Transactional注解
    RPC-局限于java的RMI
    Redis缓存雪崩、击穿、穿透的问题和解决方式
  • 原文地址:https://www.cnblogs.com/Dream-Lasting/p/4869992.html
Copyright © 2011-2022 走看看