@Test public void getAndSet() { Ref<String> ref = Ref.of("Hello World!"); UIO<String> result = ref.getAndSet("Something else"); UIO<String> afterUpdate = result.andThen(ref.get()); assertEquals("Hello World!", result.unsafeRunSync()); assertEquals("Something else", afterUpdate.unsafeRunSync()); }
public UIO<A> getAndSet(A newValue) { return UIO.task(() -> value.getAndSet(newValue)); }
Ref { public UIO<A> getAndSet(A newValue) { return UIO.task(() -> value.getAndSet(newValue)); } }
Ref { public UIO<A> getAndSet(A newValue) { return UIO.task(() -> value.getAndSet(newValue)); } private  Ref(AtomicReference<A> value); }
Ref { public UIO<A> getAndSet(A newValue) { return UIO.task(() -> value.getAndSet(newValue)); } private  Ref(AtomicReference<A> value); UIO<A> get(); UIO<Unit> set(A newValue); UIO<Unit> lazySet(A newValue); UIO<A> getAndSet(A newValue); UIO<A> updateAndGet(Operator1<A> update); UIO<A> getAndUpdate(Operator1<A> update); static Ref<A> of(A value); @Override String toString(); }
Ref { public UIO<A> getAndSet(A newValue) { return UIO.task(() -> value.getAndSet(newValue)); } private  Ref(AtomicReference<A> value); UIO<A> get(); UIO<Unit> set(A newValue); UIO<Unit> lazySet(A newValue); UIO<A> getAndSet(A newValue); UIO<A> updateAndGet(Operator1<A> update); UIO<A> getAndUpdate(Operator1<A> update); static Ref<A> of(A value); @Override String toString();  }