public static Supplier < File > fromDirectory ( File dir , String prefix , String suffix ) { return new Supplier < File > ( ) { private int count ; @ Override public File get ( ) { return new File ( ensureDir ( dir ) , String . format ( "%s%d%s" , prefix , ++ count , suffix ) ) ; } } ; }
Returns a supplier that creates sequentially named files in the given directory .