class AntPathMatcher {

    public static boolean filter(final Collection<String> includes,
                                 final Collection<String> excludes,
                                 final Path path) {
        checkNotNull("includes",
                     includes);
        checkNotNull("excludes",
                     excludes);
        checkNotNull("path",
                     path);
        if (includes.isEmpty() && excludes.isEmpty()) {
            return true;
        } else if (includes.isEmpty()) {
            return !(excludes(excludes,
                              path));
        } else if (excludes.isEmpty()) {
            return includes(includes,
                            path);
        }
        return includes(includes,
                        path) && !(excludes(excludes,
                                            path));
    }

}