@Override public T get() { synchronized (delegate) { return delegate.get(); } }
@Override public Object apply(Supplier<Object> input) { return input.get(); }
@Override protected List<V> createCollection() { return factory.get(); }
@Override protected SortedSet<V> createCollection() { return factory.get(); }
@Override protected Set<V> createCollection() { return factory.get(); }
@Override protected Collection<V> createCollection() { return factory.get(); }
public static LongAddable create() { return SUPPLIER.get(); }
public static LongAddable create() { return SUPPLIER.get(); }
@Override public T get() { // A 2-field variant of Double Checked Locking. if (!initialized) { synchronized (this) { if (!initialized) { T t = delegate.get(); value = t; initialized = true; return t; } } } return value; }
@Override public T get() { // A 2-field variant of Double Checked Locking. if (!initialized) { synchronized (this) { if (!initialized) { T t = delegate.get(); value = t; initialized = true; // Release the delegate to GC. delegate = null; return t; } } } return value; }
private Map<C, V> getOrCreate(R rowKey) { Map<C, V> map = backingMap.get(rowKey); if (map == null) { map = factory.get(); backingMap.put(rowKey, map); } return map; }
@Override public T call() throws Exception { Thread currentThread = Thread.currentThread(); String oldName = currentThread.getName(); boolean restoreName = trySetName(nameSupplier.get(), currentThread); try { return callable.call(); } finally { if (restoreName) { boolean unused = trySetName(oldName, currentThread); } } } };
@Override public void run() { Thread currentThread = Thread.currentThread(); String oldName = currentThread.getName(); boolean restoreName = trySetName(nameSupplier.get(), currentThread); try { task.run(); } finally { if (restoreName) { boolean unused = trySetName(oldName, currentThread); } } } };
@Override public T apply(@NullableDecl Object input) { return supplier.get(); }
private CompactStriped(int stripes, Supplier<L> supplier) { super(stripes); Preconditions.checkArgument(stripes <= Ints.MAX_POWER_OF_TWO, "Stripes must be <= 2^30)"); this.array = new Object[mask + 1]; for (int i = 0; i < array.length; i++) { array[i] = supplier.get(); } }
@Override public void execute(Runnable command) { MoreExecutors.newThread(threadNameSupplier.get(), command).start(); } };
@Override public T or(Supplier<? extends T> supplier) { return checkNotNull( supplier.get(), "use Optional.orNull() instead of a Supplier that returns null"); }
CustomSortedSetMultimap(Map<K, Collection<V>> map, Supplier<? extends SortedSet<V>> factory) { super(map); this.factory = checkNotNull(factory); valueComparator = factory.get().comparator(); }
@Override public V load(Object key) { checkNotNull(key); return computingSupplier.get(); }
@Override public T get() { return function.apply(supplier.get()); }