project 思考

 https://dotblogs.com.tw/kent2480/2014/01/10/139465

public class Main{ public static void main(String[] args){ Map<String, String> map = new HashMap<>(); //加入元素,加入時如果出現相同的鍵,則新的値會覆蓋原有的鍵對應值,並put方法會返回被覆蓋的値 map.put("01", "a"); map.put("02", "b"); map.put("03", "c"); System.out.println("containKey: " + map.containsKey("02"));//true System.out.println("remove: " + map.remove("03"));//c System.out.println(map);//{01=a, 02=b} //可以通過get方法的返回值來判斷一個鏈是否存在,通過返回null來判斷 System.out.println("get: " + map.get("01"));//get: a map.put("04", null); //獲取集合中所有的値 Collection<String> col = map.values(); // [null, a, b] System.out.println(col); } }

https://www.itread01.com/p/1339680.html

https://blog.csdn.net/qq_43279637/article/details/83065930


//waferCompare

1.

Map<String, String> waferComMap= new HashMap<>();

List<Map<String, String>> waferComLst= new ArrayList<Map<String, String>>();

2.

用for 迴圈把 waferID 拿出來後, 放到waferComMap 內

waferComMap.put(waferID, group);

3.

waferComLst.add(waferComMap);


4.拿資料比對

//將Data 塞入

for (Map<String, String> m : waferComLst

        m.get(waferID,group);    //waferID 內值是string.  ex:NRN111.01,CCRTT.02

}

//整合group to  waferList data

for (String k : m.keySet()) 

 { 

        System.out.println(k + " : " + m.get(k)); 

        if(k == vo.getWaferId)

        {  

            vo.setGroup(m.get(k))

        }

 } 


5.

groupLst 

Map<String,List<String>> groupLst = new HashMap<String,List<String>>();

if( groupLst!=null &&  groupLst.size()>0) {

       Iterator<Map.Entry<String, List<String>>> it = groupLst .entrySet().iterator();  

 

     while (it.hasNext()) {

                Map.Entry<String,List<String>> entry=it.next();

                System.out.println("key="+entry.getKey()+","+"value="+entry.getValue());

               if(vo.getGroup = entry.getKey()){

                     //  List<string, string> cond = (List<string, string>entry.getValue();

                      for(int i = 0; i < entry.getValue().size(); i++) {

                            //String conStr =  entry.getValue().get(i);

                            String cond1 =entry.getValue().get(1);

                            vo.setCond1 (cond1 );

                              String cond2 =entry.getValue().get(2);

                            vo.setCond2 (cond2 );

                               String cond3 =entry.getValue().get(3);

                            vo.setCond3 (cond3 );

                        String cond4 =entry.getValue().get(4);

                            vo.setCond4 (cond4);

                        String cond5 =entry.getValue().get(5);

                            vo.setCond4 (cond5);

                 

                             

        

                      }              }


       }

}


https://openhome.cc/Gossip/Java/List.html

https://www.itread01.com/content/1541179990.html

https://www.itread01.com/content/1550247671.html

原文链接:https://blog.csdn.net/fengzhimohan/article/details/79038480

https://stackoverflow.com/questions/10928004/how-to-achieve-this-mapstring-list-structure

=========

static void printUpperCase(List<String> names) {
        for(int i = 0; i < names.size(); i++) {
            String name = names.get(i);
            out.println(name.toUpperCase());
        }        
    }
 Map<String, List<String>> myMaps = new HashMap<String, List<String>>();
    for (DataObject item : myList) {
        if (!myMaps.containsKey(item.getKey())) {
            myMaps.put(item.getKey(), new ArrayList<String>());
        }
        myMaps.get(item.getKey()).add(item.getValue());
    }


Map<String,String> map = new HashMap<String,String>(); for(int i = 0; i < params.length; i++) { map.put(params[i], rs.getString(params[i])); } listmap.add(map);


Map<String,Object> testMap = new HashMap<String, String>();

testMap.put("1", "test1"); 

testMap.put("2", "test2");

List<Map<String, String>> list = new ArrayList<Map<String, String>>();

list.add(testMap);

for (Map<String, String> m : list) 

for (String k : m.keySet()) 

System.out.println(k + " : " + m.get(k)); 

}


Java Map通过值来获取键的正确姿势

https://blog.csdn.net/w605283073/article/details/85054373

https://blog.csdn.net/weixin_39648430/article/details/114057607

https://blog.csdn.net/zsp151296/article/details/76714151


留言

這個網誌中的熱門文章

AI for everyone coursera

考績被打差了 輕率離職會更傷

(影片) Advanced Playwright - Test Automation University