class FilesystemFacadeImpl implements IFilesystemFacade {

    @Override
    public Collection<IPath> listFiles(final IPath directory, final IPathFilter filter) throws IOException {
        File dir = new File(directory.getPath());

        if (!dir.isDirectory()) {
            throw new NotDirectoryException(directory.getPath());
        }

        File[] files = dir.listFiles(file -> file.isFile() && filter.accept(new Path(file)));
        IPath[] paths = new IPath[files.length];

        for (int i = 0; i < files.length; i++) {
            paths[i] = new Path(files[i]);
        }

        return Arrays.asList(paths);
    }

}