TreeMap 升序|降序排列 import java.util.Comparator; import java.util.TreeMap; public class Main { public static void main(String[] args) { TreeMap<Integer,Integer> map1 = new TreeMap<Integer,Integer>(); //默认的TreeMap升序排列 TreeMap<Integer,Integer>
数组 升序:Arrays.sort(arr); 降序: 方法一:Arrays.sort(arr,Collections.reverseOrder()); 方法二: package com.yh.sort; import java.util.Arrays; import java.util.Comparator; public class SortOverride { public static void main(String[] args) { // TODO Auto-generated m
List<test> list = new List<test> (); var result = list.OrderByDescending(p => p.we).ToList();//按照we升序排列 var result = list.OrderBy(p => p.we).ToList();//按照we降序排列 public class test { public int we { get; set; } public string ss { get; set;
mySql中,升序为asc,降序为desc.例如: 升序:select * from 表名 order by 表中的字段 asc(mysql中默认是升序排列,可不写) 降序:select * from 表名 order by 表中的字段 desc 若要进行同时一个升序,一个降序,则如下: order by 升序字段 asc,降序字段 desc.
ORDER BY _column1, _column2; /* _column1升序,_column2升序 */ ORDER BY _column1, _column2 DESC; /* _column1升序,_column2降序 */ ORDER BY _column1 DESC, _column2 ; /* _column1降序,_column2升序 */ ORDER BY _column1 DESC, _column2 DESC; /* _column1降序,_column2降