/** * Sets the elapsed time for this stopwatch to zero, and places it in a stopped state. * * @return this {@code Stopwatch} instance */ @CanIgnoreReturnValue public Stopwatch reset() { elapsedNanos = 0; isRunning = false; return this; }
/** * Implemented by the user to determine whether {@code a} and {@code b} are considered equivalent, * subject to the requirements specified in {@link #equivalent}. * * <p>This method should not be called except by {@link #equivalent}. When {@link #equivalent} * calls this method, {@code a} and {@code b} are guaranteed to be distinct, non-null instances. * * @since 10.0 (previously, subclasses would override equivalent()) */ @ForOverride protected abstract boolean doEquivalent(T a, T b);
/** * Implementations of {@link #computeNext} <b>must</b> invoke this method when there are no * elements left in the iteration. * * @return {@code null}; a convenience so your {@code computeNext} implementation can use the * simple statement {@code return endOfData();} */ @CanIgnoreReturnValue protected final T endOfData() { state = State.DONE; return null; }
/** * This method is called by {@link #startAsync} to initiate service startup. The invocation of * this method should cause a call to {@link #notifyStarted()}, either during this method's run, * or after it has returned. If startup fails, the invocation should cause a call to {@link * #notifyFailed(Throwable)} instead. * * <p>This method should return promptly; prefer to do work on a different thread where it is * convenient. It is invoked exactly once on service startup, even when {@link #startAsync} is * called multiple times. */ @ForOverride protected abstract void doStart();
@CanIgnoreReturnValue private static Object[] fillArray(Iterable<?> elements, Object[] array) { int i = 0; for (Object element : elements) { array[i++] = element; } return array; }
/** * Removes the edge connecting {@code nodeU} to {@code nodeV}, if it is present. * * @return the value previously associated with the edge connecting {@code nodeU} to {@code * nodeV}, or null if there was no such edge. */ @CanIgnoreReturnValue V removeEdge(N nodeU, N nodeV);
/** * Removes {@code node} if it is present; all edges incident to {@code node} will also be removed. * * @return {@code true} if the network was modified as a result of this call */ @CanIgnoreReturnValue boolean removeNode(N node);
/** * Removes {@code edge} from this network, if it is present. * * @return {@code true} if the network was modified as a result of this call */ @CanIgnoreReturnValue boolean removeEdge(E edge); }
/** * Remove {@code edge} from the set of incoming edges. Returns the former predecessor node. * * <p>In the undirected case, returns {@code null} if {@code isSelfLoop} is true. */ @CanIgnoreReturnValue N removeInEdge(E edge, boolean isSelfLoop);
/** * Configures the {@link ToStringHelper} so {@link #toString()} will ignore properties with null * value. The order of calling this method, relative to the {@code add()}/{@code addValue()} * methods, is not significant. * * @since 18.0 (since 12.0 as {@code Objects.ToStringHelper.omitNullValues()}). */ @CanIgnoreReturnValue public ToStringHelper omitNullValues() { omitNullValues = true; return this; }
/** * Removes {@code node} if it is present; all edges incident to {@code node} will also be removed. * * @return {@code true} if the graph was modified as a result of this call */ @CanIgnoreReturnValue boolean removeNode(N node);
/** * Removes {@code node} if it is present; all edges incident to {@code node} will also be removed. * * @return {@code true} if the graph was modified as a result of this call */ @CanIgnoreReturnValue boolean removeNode(N node);
/** * Removes the edge connecting {@code endpoints}, if it is present. * * <p>If this graph is directed, {@code endpoints} must be ordered. * * @return the value previously associated with the edge connecting {@code endpoints}, or null if * there was no such edge. */ @CanIgnoreReturnValue V removeEdge(EndpointPair<N> endpoints); }
/** * If the service state is {@link State#NEW}, this initiates service startup and returns * immediately. A stopped service may not be restarted. * * @return this * @throws IllegalStateException if the service is not {@link State#NEW} * @since 15.0 */ @CanIgnoreReturnValue Service startAsync();
/** * If the service is {@linkplain State#STARTING starting} or {@linkplain State#RUNNING running}, * this initiates service shutdown and returns immediately. If the service is {@linkplain * State#NEW new}, it is {@linkplain State#TERMINATED terminated} without having been started nor * stopped. If the service has already been stopped, this method returns immediately without * taking action. * * @return this * @since 15.0 */ @CanIgnoreReturnValue Service stopAsync();
/** * Stores all key-value pairs of {@code multimap} in this multimap, in the order returned by * {@code multimap.entries()}. * * @return {@code true} if the multimap changed */ @CanIgnoreReturnValue boolean putAll(Multimap<? extends K, ? extends V> multimap);
/** * Retrieves an instance of the appropriate type. The returned object may or may not be a new * instance, depending on the implementation. * * @return an instance of the appropriate type */ @CanIgnoreReturnValue @Override T get(); }
/** * Adds {@code node} if it is not already present. * * <p><b>Nodes must be unique</b>, just as {@code Map} keys must be. They must also be non-null. * * @return {@code true} if the graph was modified as a result of this call */ @CanIgnoreReturnValue boolean addNode(N node);
/** * Removes the edge connecting {@code nodeU} to {@code nodeV}, if it is present. * * @return {@code true} if the graph was modified as a result of this call */ @CanIgnoreReturnValue boolean removeEdge(N nodeU, N nodeV);
/** * Adds {@code node} if it is not already present. * * <p><b>Nodes must be unique</b>, just as {@code Map} keys must be. They must also be non-null. * * @return {@code true} if the graph was modified as a result of this call */ @CanIgnoreReturnValue boolean addNode(N node);