首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

怎么判断list里面内容

2012-02-05 
如何判断list里面内容。写一段if比较list[one, one, two, three, three, four, four, four, five]if(strin

如何判断list里面内容。
写一段if比较
list=[one, one, two, three, three, four, four, four, five]

if(string不重复)
{ do.......}

else
{do..........}

如何写if判断语句。

谢谢。


[解决办法]
static boolean isContains(List<String> list){
Map<String,String> map = new HashMap<String,String>();
for(String s: list){
map.put(s,s);
}
if(map.size()==list.size()){
return false;
}
System.out.println(map);
return true;
}

热点排行