import java.util.*;
public class TreeSetCheck
{
public static void main(String args[])
{
TreeSet tree=new TreeSet(new MeyComparator() );
tree.add("A");
tree.add("a");
tree.add("B");
tree.add("b");
tree.add("C");
tree.add("c");
System.out.println(tree);
}
}
class MeyComparator implements Comparator
{
@Override
public int compare(Object o1, Object o2)
{
// TODO Auto-generated method stu
String str1=(String)o1;
String str2=(String)o2;
return str2.compareTo(str1);
}
}
TreeSet的逆序存储方法设计与实现
最新推荐文章于 2022-05-10 14:12:49 发布