/** * 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; } }
/** * 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; }
/** * 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; }
/** * 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; } }
private @Nullable Iterator<? extends Iterator<? extends T>> getTopMetaIterator() { while (topMetaIterator == null || !topMetaIterator.hasNext()) { if (metaIterators != null && !metaIterators.isEmpty()) { topMetaIterator = metaIterators.removeFirst(); } else { return null; } } return topMetaIterator; }
private ToStringHelper addHolder(@Nullable Object value) { ValueHolder valueHolder = addHolder(); valueHolder.value = value; return this; }
@Override public boolean equals(@Nullable Object object) { if (object == this) { return true; } if (object instanceof ByFunctionOrdering) { ByFunctionOrdering<?, ?> that = (ByFunctionOrdering<?, ?>) object; return this.function.equals(that.function) && this.ordering.equals(that.ordering); } return false; }
@CanIgnoreReturnValue protected final @Nullable T endOfData() { state = State.DONE; return null; }
ImmutableSetMultimap( ImmutableMap<K, ImmutableSet<V>> map, int size, @Nullable Comparator<? super V> valueComparator) { super(map, size); this.emptySet = emptySet(valueComparator); }
private static <V> ImmutableSet<V> emptySet(@Nullable Comparator<? super V> valueComparator) { return (valueComparator == null) ? ImmutableSet.<V>of() : ImmutableSortedSet.<V>emptySet(valueComparator); }
@Override public boolean equals(@Nullable Object object) { if (object instanceof MapDifference.ValueDifference) { MapDifference.ValueDifference<?> that = (MapDifference.ValueDifference<?>) object; return Objects.equal(this.left, that.leftValue()) && Objects.equal(this.right, that.rightValue()); } return false; }
@Override public int lastIndexOf(@Nullable Object object) { int index = forwardList.indexOf(object); return (index >= 0) ? reverseIndex(index) : -1; }
@Override Cut<C> withUpperBoundType(BoundType boundType, DiscreteDomain<C> domain) { switch (boundType) { case CLOSED: @Nullable C previous = domain.previous(endpoint); return (previous == null) ? Cut.<C>aboveAll() : new AboveValue<C>(previous); case OPEN: return this; default: throw new AssertionError(); } }
@Override Cut<C> withLowerBoundType(BoundType boundType, DiscreteDomain<C> domain) { switch (boundType) { case OPEN: return this; case CLOSED: @Nullable C next = domain.next(endpoint); return (next == null) ? Cut.<C>belowAll() : belowValue(next); default: throw new AssertionError(); } }