java 型转换

Integer.parseInt()把String   型转换为Int型,

CollectionUtils.isEmpty(list);

CollectionUtils.isNotEmpty(list);

StringUtils.isEmpty(str);

StringUtils.isNotEmpty(str);

在 switch ( 变量 ) 这一行里,变量只能是整型或字符。没有布尔型……

switch (Integer.parseInt(String字符串)) {
                case 0:
                    str= "一般";
                    break;
                case 1:
                    str= "主任";
                    break;
                default:
                    userPostCd1 = "班长";
                    break;
                }


TableModel model;
        // DB检索结果list

HashMap<String, String> resultMap = new HashMap<String, String>();
        if (!CollectionUtils.isEmpty(list)) {

            // DB検索結果をmodelに設定する。
            for (int i = 0; i < list.size(); i++) {
                model= (TableModel) list.get(i);
                // 
                cd= model.getCd();
                // 
                cdName= model.getCdName();

                // 取得したcdがキー、cdNameが値としてHashMapに設定する
                resultMap.put(cd, cdName);
            }
        } 

        return resultMap;

你可能感兴趣的:(java 型转换)