All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gitee.starblues.utils.CommonUtils Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package com.gitee.starblues.utils;

import java.util.Comparator;
import java.util.List;
import java.util.function.Function;

/**
 * 通用工具
 *
 * @author zhangzhuo
 * @version 1.0
 */
public class CommonUtils {

    private CommonUtils(){}

    /**
     * list按照int排序
     * @param list list集合
     * @param orderImpl 排序实现
     * @param  T
     * @return List
     */
    public static  List order(List list, Function orderImpl){
        if(list == null){
            return list;
        }
        list.sort(Comparator.comparing(orderImpl, Comparator.nullsLast(Comparator.naturalOrder())));
        return list;
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy