Refine search
/** * Helper interface to implement both {@link ListenableFuture} and {@link ScheduledFuture}. * * @author Anthony Zana * @since 15.0 */ @Beta @GwtCompatible public interface ListenableScheduledFuture<V> extends ScheduledFuture<V>, ListenableFuture<V> {}
abstract class Itr<T> implements Iterator<T> { int index = 0; int toRemove = -1; abstract T output(int index); @Override public boolean hasNext() { for (; index < enumConstants.length; index++) { if (counts[index] > 0) { return true; } } return false; } @Override public T next() { if (!hasNext()) { throw new NoSuchElementException(); } T result = output(index); toRemove = index; index++; return result; } @Override public void remove() { checkRemove(toRemove >= 0);
/** * Any object which can accept registrations of {@link TearDown} instances. * * @author Kevin Bourrillion * @since 10.0 */ @Beta @GwtCompatible public interface TearDownAccepter { /** * Registers a TearDown implementor which will be run after the test proper. * * <p>In JUnit4 language, that means as an {@code @After}. * * <p>In JUnit3 language, that means during the {@link junit.framework.TestCase#tearDown()} step. */ void addTearDown(TearDown tearDown); }
@GwtCompatible(serializable = true, emulated = true) public final class HashMultiset<E> extends AbstractMapBasedMultiset<E> { @GwtIncompatible // Not needed in emulated source. private static final long serialVersionUID = 0;
/** * Static utility methods pertaining to the {@link Runnable} interface. * * @since 16.0 */ @Beta @GwtCompatible public final class Runnables { private static final Runnable EMPTY_RUNNABLE = new Runnable() { @Override public void run() {} }; /** Returns a {@link Runnable} instance that does nothing when run. */ public static Runnable doNothing() { return EMPTY_RUNNABLE; } private Runnables() {} }
@GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization public final class LinkedHashMultiset<E> extends AbstractMapBasedMultiset<E> { @GwtIncompatible // not needed in emulated source private static final long serialVersionUID = 0;
/** * Simple utility for when you want to create a {@link TearDown} that may throw an exception but * should not fail a test when it does. (The behavior of a {@code TearDown} that throws an exception * varies; see its documentation for details.) Use it just like a {@code TearDown}, except override * {@link #sloppyTearDown()} instead. * * @author Luiz-Otavio Zorzella * @since 10.0 */ @Beta @GwtCompatible public abstract class SloppyTearDown implements TearDown { private static final Logger logger = Logger.getLogger(SloppyTearDown.class.getName()); @Override public final void tearDown() { try { sloppyTearDown(); } catch (Throwable t) { logger.log(Level.INFO, "exception thrown during tearDown: " + t.getMessage(), t); } } public abstract void sloppyTearDown() throws Exception; }
@GwtCompatible(emulated = true) public final class EnumHashBiMap<K extends Enum<K>, V> extends AbstractBiMap<K, V> { private transient Class<K> keyType; @GwtIncompatible // only needed in emulated source. private static final long serialVersionUID = 0;
/** * Helper interface to implement both {@link ListenableFuture} and {@link ScheduledFuture}. * * @author Anthony Zana * @since 15.0 */ @Beta @GwtCompatible public interface ListenableScheduledFuture<V> extends ScheduledFuture<V>, ListenableFuture<V> {}
@GwtCompatible final class CollectCollectors { static <T, K, V> Collector<T, ?, ImmutableBiMap<K, V>> toImmutableBiMap( @GwtIncompatible private static final Collector<Range<Comparable>, ?, ImmutableRangeSet<Comparable>> TO_IMMUTABLE_RANGE_SET =
/** * Computes a value, possibly asynchronously. For an example usage and more information, see {@link * Futures.FutureCombiner#callAsync(AsyncCallable, java.util.concurrent.Executor)}. * * <p>Much like {@link java.util.concurrent.Callable}, but returning a {@link ListenableFuture} * result. * * @since 20.0 */ @Beta @FunctionalInterface @GwtCompatible public interface AsyncCallable<V> { /** * Computes a result {@code Future}. The output {@code Future} need not be {@linkplain * Future#isDone done}, making {@code AsyncCallable} suitable for asynchronous derivations. * * <p>Throwing an exception from this method is equivalent to returning a failing {@link * ListenableFuture}. */ ListenableFuture<V> call() throws Exception; }
@GwtCompatible(emulated = true) public final class EnumBiMap<K extends Enum<K>, V extends Enum<V>> extends AbstractBiMap<K, V> { private transient Class<K> keyType; @GwtIncompatible // not needed in emulated source. private static final long serialVersionUID = 0;
@Beta @GwtCompatible public abstract class Ticker {
@GwtCompatible(emulated = true) public final class Enums { @GwtIncompatible // java.lang.ref.WeakReference private static final Map<Class<? extends Enum<?>>, Map<String, WeakReference<? extends Enum<?>>>> enumConstantCache = new WeakHashMap<>();
@GwtCompatible @Beta public final class PublicSuffixPatterns { private PublicSuffixPatterns() {}
@GwtCompatible(serializable = true, emulated = true) public class TreeMultimap<K, V> extends AbstractSortedKeySortedSetMultimap<K, V> { private transient Comparator<? super K> keyComparator; @GwtIncompatible // not needed in emulated source private static final long serialVersionUID = 0;
/** * An object that can perform a {@link #tearDown} operation. * * @author Kevin Bourrillion * @since 10.0 */ @Beta @FunctionalInterface @GwtCompatible public interface TearDown { /** * Performs a <b>single</b> tear-down operation. See test-libraries-for-java's {@code * com.google.common.testing.junit3.TearDownTestCase} and {@code * com.google.common.testing.junit4.TearDownTestCase} for example. * * <p>A failing {@link TearDown} may or may not fail a tl4j test, depending on the version of * JUnit test case you are running under. To avoid failing in the face of an exception regardless * of JUnit version, implement a {@link SloppyTearDown} instead. * * <p>tl4j details: For backwards compatibility, {@code junit3.TearDownTestCase} currently does * not fail a test when an exception is thrown from one of its {@link TearDown} instances, but * this is subject to change. Also, {@code junit4.TearDownTestCase} will. * * @throws Exception for any reason. {@code TearDownTestCase} ensures that any exception thrown * will not interfere with other TearDown operations. */ void tearDown() throws Exception; }
@GwtCompatible(serializable = true, emulated = true) public final class HashMultimap<K, V> extends HashMultimapGwtSerializationDependencies<K, V> { private static final int DEFAULT_VALUES_PER_KEY = 2; @GwtIncompatible // Not needed in emulated source private static final long serialVersionUID = 0;
@Beta @GwtCompatible public class FakeTicker extends Ticker {
@GwtCompatible(serializable = true, emulated = true) public class HashMultiset<E> extends AbstractMapBasedMultiset<E> { @GwtIncompatible // Not needed in emulated source. private static final long serialVersionUID = 0;