/** * Notify pending loads that a new value was set. This is only relevant to loading value * references. */ void notifyNewValue(@Nullable V newValue);
@Override public ValueReference<K, V> copyFor( ReferenceQueue<V> queue, @Nullable V value, ReferenceEntry<K, V> entry) { return this; } }
/** * Two ordered {@link EndpointPair}s are equal if their {@link #source()} and {@link #target()} * are equal. Two unordered {@link EndpointPair}s are equal if they contain the same nodes. An * ordered {@link EndpointPair} is never equal to an unordered {@link EndpointPair}. */ @Override public abstract boolean equals(@Nullable Object obj);
/** * Determines whether this multiset contains the specified element. * * <p>This method refines {@link Collection#contains} to further specify that it <b>may not</b> * throw an exception in response to {@code element} being null or of the wrong type. * * @param element the element to check for * @return {@code true} if this multiset contains at least one occurrence of the element */ @Override boolean contains(@Nullable Object element);
/** * Returns {@code true} if {@code obj} is another {@code RangeMap} that has an equivalent {@link * #asMapOfRanges()}. */ @Override boolean equals(@Nullable Object o);
@Override public V setValue(@Nullable V newValue) { V result = value; this.value = newValue; return result; } }
/** * Returns a view collection of the values associated with {@code key} in this multimap, if any. * Note that when {@code containsKey(key)} is false, this returns an empty collection, not {@code * null}. * * <p>Changes to the returned collection will update the underlying multimap, and vice versa. */ Collection<V> get(@Nullable K key);
@Override public boolean equals(@Nullable Object object) { if (object instanceof StringConverter) { StringConverter<?> that = (StringConverter<?>) object; return this.enumClass.equals(that.enumClass); } return false; }
@Override public boolean equals(@Nullable Object obj) { if (obj instanceof SupplierFunction) { SupplierFunction<?> that = (SupplierFunction<?>) obj; return this.supplier.equals(that.supplier); } return false; }
@Override public boolean equals(@Nullable Object obj) { if (obj == this) { return true; } if (!(obj instanceof ElementOrder)) { return false; } ElementOrder<?> other = (ElementOrder<?>) obj; return (type == other.type) && Objects.equal(comparator, other.comparator); }
UnmodifiableBiMap(BiMap<? extends K, ? extends V> delegate, @Nullable BiMap<V, K> inverse) { unmodifiableMap = Collections.unmodifiableMap(delegate); this.delegate = delegate; this.inverse = inverse; }
@Override public boolean contains(@Nullable Object obj) { return inEdgeMap.containsKey(obj) || outEdgeMap.containsKey(obj); } };
@Override public boolean contains(@Nullable Object edge) { return targetNode.equals(outEdgeToNode.get(edge)); } }
/** * Delegates to {@link Collection#contains}. Returns {@code false} if the {@code contains} method * throws a {@code ClassCastException} or {@code NullPointerException}. */ static boolean safeContains(Collection<?> collection, @Nullable Object object) { checkNotNull(collection); try { return collection.contains(object); } catch (ClassCastException | NullPointerException e) { return false; } }
/** * Returns an immutable list of the values for the given key. If no mappings in the multimap have * the provided key, an empty immutable list is returned. The values are in the same order as the * parameters used to build this multimap. */ @Override public ImmutableList<V> get(@Nullable K key) { // This cast is safe as its type is known in constructor. ImmutableList<V> list = (ImmutableList<V>) map.get(key); return (list == null) ? ImmutableList.<V>of() : list; }
protected V getIfCached(@Nullable Object key) { Entry<K, V> entry = entrySetCache; // store local reference for thread-safety // Check cache. We use == on purpose because it's cheaper and a cache miss is ok. if (entry != null && entry.getKey() == key) { return entry.getValue(); } return null; }
/** * Stores a key-value pair in this multimap. * * <p>Some multimap implementations allow duplicate key-value pairs, in which case {@code put} * always adds a new key-value pair and increases the multimap size by 1. Other implementations * prohibit duplicates, and storing a key-value pair that's already in the multimap has no effect. * * @return {@code true} if the method increased the size of the multimap, or {@code false} if the * multimap already contained the key-value pair and doesn't allow duplicates */ @CanIgnoreReturnValue boolean put(@Nullable K key, @Nullable V value);
/** * Delegates to {@link Map#get}. Returns {@code null} on {@code ClassCastException} and {@code * NullPointerException}. */ static <V> V safeGet(Map<?, V> map, @Nullable Object key) { checkNotNull(map); try { return map.get(key); } catch (ClassCastException | NullPointerException e) { return null; } }