Skip to content

Instantly share code, notes, and snippets.

@wsoczynski
Created March 25, 2013 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wsoczynski/5236774 to your computer and use it in GitHub Desktop.
Save wsoczynski/5236774 to your computer and use it in GitHub Desktop.
class ConcatPath implements Function<String,String> {
private final String subPath;
private ConcatPath(String subPath){
this.subPath = subPath;
}
@Override
public String apply(String basePath){
return FilenameUtils.concat(basePath,subPath);
}
public static ConcatPath with(String subPath){
return new ConcatPath(subPath);
}
}
public class FileCreator implements Function<String, File> {
@Override
public File apply(String path){
File result = new File(path);
return result;
}
}
public class FileExistanceChecker implements Predicate<File> {
@Override
public boolean apply(File input){
return input.exists();
}
}
public class File {
public static FileCreator createFromPath(){
return new FileCreator();
}
public static FileExistanceChecker ifExists(){
return new FileExistanceChecker();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment