实现一个Comparator就可以了
代码如下:
import javautilArrays;
import javautilComparator;
public class ChineseSort {
public static void main(String[] args) {
String[] list = {
"丙方",
"乙方",
"甲方",
"辛方",
"戊方", };
Systemoutprintln("排序前: " + ArraystoString(list));
sort(list);
Systemoutprintln("排序后: " + ArraystoString(list));
}
public static void sort(String[] args) {
Comparator<String> comparator = new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return getIndex(o1) - getIndex(o2);
}
};
Arrayssort(args, comparator);
}
private static int getIndex(String s) {
for (int i = 0; i < DEFAULT_ARRAYlength; i++) {
if (sequals(DEFAULT_ARRAY[i])) {
return i;
}
}
throw new RuntimeException("输入文字错误");
}
private static final String[] DEFAULT_ARRAY = {
"甲方",
"乙方",
"丙方",
"丁方",
"戊方",
"己方",
"庚方",
"辛方",
"壬方",
"癸方" };
}
以上就是关于关于Itti的MATLAB算法全部的内容,包括:关于Itti的MATLAB算法、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)