1.定义函数 /** * 数组对象排序函数 * @param {any} name 排序字段 * @param {any} order 升.降(这里事true.false记得处理下) */ var by = function (name,order) { return function (o, p) { var a, b; if (typeof o === "object" && typeof p === "object" && o
注:对象排序,就是对对象中的某一字段进行比较,以正序或倒序进行排序. 例: 需要排序的对象: public class Person { public int age; public String name; public Person (int age, String name){ this.age = age; this.name = name; }} 实现排序功能的类: import java.util.Comparator; public class OrderUtil imple