Issue 31 — Part 1

Quite some changes, but I think this releases #52 #39 (at least when I'm done with this one here on #31) and #75 for others to work on.
Bunch of tests to be added for #52 #39 and #75 as well... 
Right. A function being stateless and free of side effects, it's
threadsafe. This is a memoizer and as such stateful. I decided to make it
_not_ threadsafe, as it's not needed and avoids overhead. Overhead the jit
would probably elide eventually. But I'd rather leave it so for now. Maybe
this shouldn't be part of the api

On Thursday, October 2, 2014, vfunshteyn <notifications@github.com> wrote:

> In api/src/main/java/org/ehcache/function/Functions.java:
>
> > +  public static <A, B, T> BiFunction<A, B, T> memoize(BiFunction<A, B, T> f) {
> > +    return new MemoizingBiFunction<A, B, T>(f);
> > +  }
> > +
> > +  private static final class MemoizingFunction<A, T> implements Function<A, T> {
> > +
> > +    private final Function<A, T> function;
> > +    private boolean computed;
> > +    private T value;
> > +
> > +    private MemoizingFunction(final Function<A, T> function) {
> > +      this.function = function;
> > +    }
> > +
> > +    @Override
> > +    public T apply(final A a) {
>
> Is the Function API known to not be guaranteed to be thread safe, or does
> this implementation just chooses not to?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/ehcache/ehcache3/pull/98/files#r18377005>.
>


-- 
Alex Snaps <alex.snaps@gmail.com>
Principal Software Engineer - Terracotta
http://twitter.com/alexsnaps
http://about.me/alexsnaps
http://www.devoxx4kids.org/quebec/