import java.util.*;public class aa {
public static void main(String[] args) {
SortedSet set=new TreeSet(new Comparator()
{ public int compare(Object o1, Object o2) {
if(Integer.parseInt(o1.toString())>Integer.parseInt(o2.toString()))
return 1;
else
return
-1;
}
});
set.add("1");
set.add("5");
set.add("3");
System.out.println(set);
set.remove("1");//为什么删除不了
System.out.println(set);}
}
public static void main(String[] args) {
SortedSet set=new TreeSet(new Comparator()
{ public int compare(Object o1, Object o2) {
if(Integer.parseInt(o1.toString())>Integer.parseInt(o2.toString()))
return 1;
else
return
-1;
}
});
set.add("1");
set.add("5");
set.add("3");
System.out.println(set);
set.remove("1");//为什么删除不了
System.out.println(set);}
}
解决方案 »
- 十万火急:java选项卡
- 关于poi 的研究
- 还是关于jdbc和oracle的问题 不能找到数据库里面的表
- 我拷,我写的这句代码。jbuilder居然过了,幸好没出过问题。
- 我这个JList的程序怎麽不能添加,删除菜单项,那位兄弟告诉我怎麽回事,谢谢.
- 我快崩溃了,每次安装好jdk142,重启系统就提示ntldr丢失?
- 北京的朋友来看看
- 那里有sqlserver jdbc下载和tomcat配套起来用的,在线等待!!
- 我的TOMCAT 4.0 的STARTUP.BAT 运行失败!
- 请大家提供一个Jive Version: 2.1.1 的源代码!100分奉送
- 请问如何截取一个double类型的数据
- 关于Vector的一点疑问
return (Integer.parseInt(o1.toString()) - Integer.parseInt(o2
.toString()));
}
set.add("1");
set.add("5");
set.add("3");
System.out.println(set);
set.remove("1");
System.out.println(set);
import java.util.*; public class aa {
public static void main(String[] args) {
SortedSet set=new TreeSet(new Comparator(){
public int compare(Object o1, Object o2) {
if (Double.parseDouble(o1.toString())
>Double.parseDouble(o2.toString()))
return 1;
else if(Double.parseDouble(o1.toString())
<Double.parseDouble(o2.toString()))
return -1;
else
return 0;
}
});
set.add("1");
set.add("5");
set.add("3");
System.out.println(set);
set.remove("1");//为什么删除不了
System.out.println(set); }
}
为什么没有=0的返回值 remove无法移除