Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;
import java.io.FilenameFilter;
import java.util.Arrays;
import java.util.Comparator;

public class Main {
    private static FilenameFilter filter;
    private static Comparator<File> comparator;

    public static File[] listFiles(File f) {
        File[] list;
        if (f.isDirectory()) {
            list = f.listFiles(filter);
            if (list != null) {
                Arrays.sort(list, comparator);
            }
        } else {
            list = new File[] {};
        }
        return list;
    }
}