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
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进行数据转换及处理,包括通过Integer.parseInt()实现字符串到整数的转换,利用Apache Commons Lang和Collections工具包判断集合及字符串是否为空,并展示了如何将数据库查询结果映射到HashMap中。

被折叠的 条评论
为什么被折叠?



