根據一段自定義的順序排序

2021-06-22 13:16:17 字數 428 閱讀 8414

最近用到排序 有個集合公升序和降序都不是理想的結果,然後用了個根據下標排序的方法

listlist = new arraylist<>();

list.add("小");

list.add("雙");

list.add("單");

list.add("大");

string valstr = "大小單雙";

listslist = new arraylist();

for (string s : list)

collections.sort(slist); //對下標排序

string sortstr = "";

for (int index : slist)

system.out.println(sortstr);

ORACLE自定義順序排序

oracle可以借助decode函式,自定義順序排序 select from select nick as item from dual union allselect viki as item from dual union allselect glen as item from dual uni...

ORACLE自定義順序排序

oracle可以借助decode函式,自定義順序排序 select from select nick as item from dual union allselect viki as item from dual union allselect glen as item from dual uni...

mysql按自定義順序排序

order by field 排序列,value1,value2.desc asc select from sy cd ms base hospital info order by field grade,三甲 三乙 三丙 二甲 asc 圖中按照 三甲 三乙 三丙 二甲 的順序排列,沒有在排序中包含...