What is difference between null and empty list?

后端 未结 4 2023
别跟我提以往
别跟我提以往 2021-01-19 01:14
List> pcList = null;
Map pcMap = new HashMap();
ComputerConfigurations tempPC = null;

if         


        
4条回答
  •  甜味超标
    2021-01-19 01:56

        List> pcList = new ArrayList>();
        Map pcMap = new HashMap();
        ComputerConfigurations tempPC = null;
    
        if (historyList != null) {
            Iterator iterator = historyList.iterator();
            while (iterator.hasNext()) {
                tempPC = (ComputerConfigurations) iterator.next();
                pcMap.put(tempPC.getEnvironment(), tempPC);
                pcList.add((Map) pcMap);
            }
        }
    

提交回复
热议问题