K0NRAD
2/10/2014 - 7:02 AM

guava DateFormatFunction

guava DateFormatFunction

public class StringToDateFunction implements Function<String,Function<Date,String>> {

    @Override
    public Function<Date, String> apply(String string) {
         return new DateFormatFunction(string);
    }
}
public class DateFormatFunction implements Function<Date,String> {

    private String format;

    public formatFunction(String format) {
        this.format = format;
    }

    @Override
    public String apply(Date date) {
        return new Simpleformat(format).format(date);
    }
}