基于Java多线程操作文件案例分享(2)


package com.linuxidc.favthread.main;
 
import java.io.File;
import java.util.List;
 
import com.linuxidc.favthread.util.FavFileUtil;
import com.linuxidc.favthread.util.FavThreadUtil;
 
public class Main {
 
    public static void main(String[] args) {
        List<File> fileList = FavFileUtil.getFileList("D:\\log");
        List<File> aList = fileList.subList(0, 10);
        List<File> bList = fileList.subList(10, 20);
        FavThreadUtil afavThreatUtil = new FavThreadUtil(aList);
        FavThreadUtil bfavThreatUtil = new FavThreadUtil(bList);
        new Thread(afavThreatUtil, "线程1").start();
        new Thread(bfavThreatUtil, "线程2").start();
    }
 
}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/4ceafa6a70653041589faaf06f7c807f.html