您好,欢迎来到华佗小知识。
搜索
您的当前位置:首页文件大小排序

文件大小排序

来源:华佗小知识
/**
* 文件排序
*/
class CompratorByLastModified implements Comparator<File> {
public int compare(File f1, File f2) {
long diff = f1.length() - f2.length();
if (diff > 0)
return -1;//倒序正序控制
else if (diff == 0)
return 0;
else
return 1;//倒序正序控制
}
public boolean equals(Object obj) {
return true;
}
}
/**
* 文件排序
*/
class CompratorByLastModified implements Comparator<File> {
public int compare(File f1, File f2) {
long diff = f1.length() - f2.length();
if (diff > 0)
return -1;//倒序正序控制
else if (diff == 0)
return 0;
else
return 1;//倒序正序控制
}
public boolean equals(Object obj) {
return true;
}
}

转载于:https://www.cnblogs.com/zuokun/p/11572988.html

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- huatuo0.cn 版权所有 湘ICP备2023017654号-2

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务