I'm using [Guava collections' transform functions](https://code.google.com/p/guava-libraries/wiki/FunctionalExplained#Functions), and finding myself making a lot of anonymous functions like this pseudocode:

```
    Function<T, R> TransformFunction = new Function<T, R>() {
        public R apply(T obj) {
            // do what you need to get R out of T
            return R;
        }
    };

```

...but since I need to reuse some of them, I'd like to put the frequent ones into a class for easy access.

I'm embarrassed to say (since I don't use Java much), I can't figure out how to make a class method return a function like this. Can you?