public static FileFilter adapt ( final Filter < File > toAdapt ) { // Check sanity Validate . notNull ( toAdapt , "toAdapt" ) ; // Already a FileFilter? if ( toAdapt instanceof FileFilter ) { return ( FileFilter ) toAdapt ; } // Wrap and return. return new FileFilter ( ) { @ Override public boolean accept ( final File candidate ) { return toAdapt . accept ( candidate ) ; } } ; }
Adapts the Filter specification to the FileFilter interface to enable immediate use for filtering File lists .