package com.younike.common.utils.list;

import org.apache.commons.collections.CollectionUtils;

import java.util.List;

/**
 * list 工具类
 * 2021-8-26 Another
 */
public class SelfWritingListUtils {

    /**
     * 判断 long型 list是否都是升序排列
     * @param longList
     * @return
     */
    public static boolean isAscendingOrder(List<Long> longList) {
        if (CollectionUtils.isNotEmpty(longList)) {
            Long[] longArray = longList.toArray(new Long[longList.size()]);
            for (int i = 0; i < longList.size()-1; i++) {
                if (longArray[i] >= longArray[i+1]) {
                    return false;
                }
            }
            return true;
        }
        return false;
    }

}
