MCPcopy Create free account
hub / github.com/traneio/future / set

Method set

future-java/src/main/java/io/trane/future/Local.java:141–154  ·  view source on GitHub ↗

Sets the value of the local. It's similar to update but receives an optional value. @param opt optional value to set.

(final Optional<T> opt)

Source from the content-addressed store, hash-verified

139 * @param opt optional value to set.
140 */
141 public final void set(final Optional<T> opt) {
142 Optional<?>[] ctx = threadLocal.get();
143
144 if (ctx == null)
145 ctx = new Optional<?>[size];
146 else {
147 final Optional<?>[] oldCtx = ctx;
148 ctx = new Optional<?>[size];
149 System.arraycopy(oldCtx, 0, ctx, 0, oldCtx.length);
150 }
151
152 ctx[position] = opt;
153 threadLocal.set(ctx);
154 }
155
156 /**
157 * Gets the current value of the local.

Callers 15

updateMethod · 0.95
letMethod · 0.95
ensureMethod · 0.80
applyWithLocalMethod · 0.80
applyHandlerWithLocalMethod · 0.80
createMethod · 0.80
becomeIfEmptyLocalsMethod · 0.80
runMethod · 0.80

Calls 1

getMethod · 0.65

Tested by 15

ensureMethod · 0.64
applyWithLocalMethod · 0.64
applyHandlerWithLocalMethod · 0.64
createMethod · 0.64
becomeIfEmptyLocalsMethod · 0.64
runMethod · 0.64
ensureMethod · 0.64
onExceptionMethod · 0.64