package com.dxhy.portrait.business.util;

import java.util.Comparator;

import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.SftpATTRS;

/**
 * @ClassName MyCompare
 *
 * @Author wyh
 * @Date 2019/11/26 19:50
 * @Version 1.0
 **/
public class MyComparator implements Comparator<ChannelSftp.LsEntry> {
    @Override
    public int compare(ChannelSftp.LsEntry left, ChannelSftp.LsEntry right) {
        SftpATTRS attr1 = left.getAttrs();
        SftpATTRS attr2 = right.getAttrs();
        Integer currentOldestTime1 = attr1.getMTime();
        Integer currentOldestTime2 = attr2.getMTime();
        return currentOldestTime1.compareTo(currentOldestTime2);
    }
}
