private V unfold(Reference<V> ref) { if (ref == null) { return null; } return ref.get(); }
private V unfold(Reference<V> ref) { if (ref == null) { return null; } return ref.get(); }
@Override public T getNoLock(K key) { Reference<T> ref = map.get(key); if (ref != null) { return ref.get(); } else { return null; } }
/** Remove this allocation from the connection's list of allocations. */ private void release(RealConnection connection) { for (int i = 0, size = connection.allocations.size(); i < size; i++) { Reference<StreamAllocation> reference = connection.allocations.get(i); if (reference.get() == this) { connection.allocations.remove(i); return; } } throw new IllegalStateException(); }
@Override public Bitmap get(String key) { Bitmap result = null; Reference<Bitmap> reference = softMap.get(key); if (reference != null) { result = reference.get(); } return result; }
@Override public Bitmap remove(String key) { Reference<Bitmap> bmpRef = softMap.remove(key); return bmpRef == null ? null : bmpRef.get(); }
public class DataHolder { Map<String, WeakReference<Object>> data = new HashMap<String, WeakReference<Object>>(); void save(String id, Object object) { data.put(id, new WeakReference<Object>(object)); } Object retrieve(String id) { WeakReference<Object> objectWeakReference = data.get(id); return objectWeakReference.get(); } }
@Override public int getId() { View view = viewRef.get(); return view == null ? super.hashCode() : view.hashCode(); }
/** Remove this allocation from the connection's list of allocations. */ private void release(RealConnection connection) { for (int i = 0, size = connection.allocations.size(); i < size; i++) { Reference<StreamAllocation> reference = connection.allocations.get(i); if (reference.get() == this) { connection.allocations.remove(i); return; } } throw new IllegalStateException(); }
private Object readResolve() { Reference<?> ref = serializableFactories.get(this.id); if (ref != null) { Object result = ref.get(); if (result != null) { return result; } } // Lenient fallback: dummy factory in case of original factory not found... DefaultListableBeanFactory dummyFactory = new DefaultListableBeanFactory(); dummyFactory.serializationId = this.id; return dummyFactory; } }
@SuppressWarnings("rawtypes") public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException { Object item; if (object instanceof AtomicReference) { AtomicReference val = (AtomicReference) object; item = val.get(); } else { item = ((Reference) object).get(); } serializer.write(item); }
public T get2NoLock(long key) { Reference<T> ref = map.get(key); if (ref != null) { return ref.get(); } else { return null; } }
@Override public V getValue() { super.getValue(); return ref.get(); }
public T get2(long key) { lock.lock(); Reference<T> ref; try { ref = map.get(key); } finally { lock.unlock(); } if (ref != null) { return ref.get(); } else { return null; } }
@Override public V getValue() { super.getValue(); return ref.get(); }
private static <T> @Nullable T getReference(@Nullable Reference<T> reference) { return (reference == null) ? null : reference.get(); } }
private static <T> @Nullable T getReference(@Nullable Reference<T> reference) { return (reference == null) ? null : reference.get(); } }
@NullableDecl private static <T> T getReference(@NullableDecl Reference<T> reference) { return (reference == null) ? null : reference.get(); } }
@NullableDecl private static <T> T getReference(@NullableDecl Reference<T> reference) { return (reference == null) ? null : reference.get(); } }
@Override public ViewScaleType getScaleType() { ImageView imageView = (ImageView) viewRef.get(); if (imageView != null) { return ViewScaleType.fromImageView(imageView); } return super.getScaleType(); }