@Test public void updateAndGet() { Reference<F, String> ref = makeRef("Hello World!"); Kind<F, String> result = ref.updateAndGet(String::toUpperCase); assertEquals("HELLO WORLD!", run(result)); }
@Override public Kind<F, A> updateAndGet(Operator1<A> update) { return monadF.later(() -> value.updateAndGet(update::apply)); }
MonadDeferReference implements Reference<F, A> { @Override public Kind<F, A> updateAndGet(Operator1<A> update) { return monadF.later(() -> value.updateAndGet(update::apply)); } }
MonadDeferReference implements Reference<F, A> { @Override public Kind<F, A> updateAndGet(Operator1<A> update) { return monadF.later(() -> value.updateAndGet(update::apply)); } MonadDeferReference(MonadDefer<F> monadF, AtomicReference<A> value); }
MonadDeferReference implements Reference<F, A> { @Override public Kind<F, A> updateAndGet(Operator1<A> update) { return monadF.later(() -> value.updateAndGet(update::apply)); } MonadDeferReference(MonadDefer<F> monadF, AtomicReference<A> value); @Override Kind<F, A> get(); @Override Kind<F, Unit> set(A newValue); @Override Kind<F, A> getAndSet(A newValue); @Override Kind<F, A> updateAndGet(Operator1<A> update); @Override Kind<F, A> getAndUpdate(Operator1<A> update); @Override String toString(); }
MonadDeferReference implements Reference<F, A> { @Override public Kind<F, A> updateAndGet(Operator1<A> update) { return monadF.later(() -> value.updateAndGet(update::apply)); } MonadDeferReference(MonadDefer<F> monadF, AtomicReference<A> value); @Override Kind<F, A> get(); @Override Kind<F, Unit> set(A newValue); @Override Kind<F, A> getAndSet(A newValue); @Override Kind<F, A> updateAndGet(Operator1<A> update); @Override Kind<F, A> getAndUpdate(Operator1<A> update); @Override String toString();  }