public class T {
public static void main(String[] args) {
// TODO Auto-generated method stub
List> list = new ArrayList>();
Map m1 = new HashMap();
m1.put("NAME", "北京");
m1.put("STATE", "1");
Map m2 = new HashMap();
m2.put("NAME", "上海");
m2.put("STATE", "1");
Map m3 = new HashMap();
m3.put("NAME", "广州");
m3.put("STATE", "2");
list.add(m1);
list.add(m2);
list.add(m3);
Iterator> ite = list.iterator();
while(ite.hasNext()){
Map m = ite.next();
//如果STATE值为2的删除
if("2".equals(m.get("STATE"))){
ite.remove();
}
}
for(Map map:list){
System.out.println(map.get("NAME")+"--"+map.get("STATE"));
}
System.out.println("--------------------");
Integer k = 10;
String m = "10";
System.out.println("10".equals(k)); //false
System.out.println("10".equals(m)); //true
}
}
版权声明:本文为博主原创文章,未经博主允许不得转载。