Top Description Fields Constructors Methods
com.google.common.graph

pack-priv final Class InvalidatableSet<E>

extends ForwardingSet<E>
Class Inheritance
Annotations
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull

A subclass of `ForwardingSet` that throws `IllegalStateException` on invocation of any method (except `hashCode` and `equals`) if the provided `Supplier` returns false.

Field Summary

Modifier and TypeField and Description
private final Set<E>
private final Supplier<String>
private final Supplier<Boolean>

Constructor Summary

AccessConstructor and Description
private
InvalidatableSet(Set<E> delegate, Supplier<Boolean> validator, Supplier<String> errorMessage)

Method Summary

Modifier and TypeMethod and Description
protected Set<E>
delegate()

Implements abstract com.google.common.collect.ForwardingSet.delegate.

Returns the backing delegate instance that methods are forwarded to.
public int
public static final <E> InvalidatableSet<E>
of(Set<E>
the first element
delegate
,
Supplier<Boolean>
the second element
validator
,
Supplier<String>
the third element
errorMessage
)

Hides java.util.Set.of.

Returns an unmodifiable set containing three elements.
private void
Inherited from com.google.common.collect.ForwardingSet:
equalsstandardEqualsstandardHashCodestandardRemoveAll

Field Detail

delegateback to summary
private final Set<E> delegate
errorMessageback to summary
private final Supplier<String> errorMessage
validatorback to summary
private final Supplier<Boolean> validator

Constructor Detail

InvalidatableSetback to summary
private InvalidatableSet(Set<E> delegate, Supplier<Boolean> validator, Supplier<String> errorMessage)

Method Detail

delegateback to summary
protected Set<E> delegate()

Implements abstract com.google.common.collect.ForwardingSet.delegate.

Doc from com.google.common.collect.ForwardingObject.delegate.

Returns the backing delegate instance that methods are forwarded to. Abstract subclasses generally override this method with an abstract method that has a more specific return type, such as ForwardingSet#delegate. Concrete subclasses override this method to supply the instance being decorated.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides com.google.common.collect.ForwardingSet.hashCode.

Implements java.util.Set.hashCode, java.util.Collection.hashCode.

Doc from java.util.Set.hashCode.

Returns the hash code value for this set. The hash code of a set is defined to be the sum of the hash codes of the elements in the set, where the hash code of a null element is defined to be zero. This ensures that s1.equals(s2) implies that s1.hashCode()==s2.hashCode() for any two sets s1 and s2, as required by the general contract of Object#hashCode.

Returns:int

the hash code value for this set

Annotations
@Override
ofback to summary
public static final <E> InvalidatableSet<E> of(Set<E> delegate, Supplier<Boolean> validator, Supplier<String> errorMessage)

Hides java.util.Set.of.

Doc from java.util.Set.of.

Returns an unmodifiable set containing three elements. See Unmodifiable Sets for details.

Parameters
<E>
the Set's element type
delegate:Set<E>

the first element

validator:Supplier<Boolean>

the second element

errorMessage:Supplier<String>

the third element

Returns:InvalidatableSet<E>

a Set containing the specified elements

validateback to summary
private void validate()