Uses of Class
com.google.common.annotations.Beta
-
Packages that use Beta Package Description com.google.common.base Basic utility libraries and interfaces.com.google.common.collect This package contains generic collection interfaces and implementations, and other utilities for working with collections.com.google.common.escape Interfaces, utilities, and simple implementations of escapers and encoders.com.google.common.eventbus The EventBus allows publish-subscribe-style communication between components without requiring the components to explicitly register with one another (and thus be aware of each other).com.google.common.graph An API for representing graph (node and edge) data.com.google.common.hash Hash functions and related structures.com.google.common.io This package contains utility methods and classes for working with Java I/O; for example input streams, output streams, readers, writers, and files.com.google.common.math Arithmetic functions operating on primitive values andBigInteger
instances.com.google.common.net This package contains utility methods and classes for working with net addresses (numeric IP and domain names).com.google.common.primitives Static utilities for working with the eight primitive types andvoid
, and value types for treating them as unsigned.com.google.common.reflect This package contains utilities to work with Java reflection.com.google.common.util.concurrent Concurrency utilities.com.google.common.xml Escapers for XML. -
-
Uses of Beta in com.google.common.base
Classes in com.google.common.base with annotations of type Beta Modifier and Type Class Description static class
Splitter.MapSplitter
An object that splits strings into maps asSplitter
splits iterables and lists.class
Utf8
Low-level, high-performance utility methods related to the UTF-8 character encoding.Methods in com.google.common.base with annotations of type Beta Modifier and Type Method Description <A extends Appendable>
AJoiner.MapJoiner. appendTo(A appendable, Iterable<? extends Map.Entry<?,?>> entries)
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, toappendable
.<A extends Appendable>
AJoiner.MapJoiner. appendTo(A appendable, Iterator<? extends Map.Entry<?,?>> parts)
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, toappendable
.StringBuilder
Joiner.MapJoiner. appendTo(StringBuilder builder, Iterable<? extends Map.Entry<?,?>> entries)
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, tobuilder
.StringBuilder
Joiner.MapJoiner. appendTo(StringBuilder builder, Iterator<? extends Map.Entry<?,?>> entries)
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, tobuilder
.static List<Throwable>
Throwables. getCausalChain(Throwable throwable)
Gets aThrowable
cause chain as a list.static <X extends Throwable>
XThrowables. getCauseAs(Throwable throwable, Class<X> expectedCauseType)
Returnsthrowable
's cause, cast toexpectedCauseType
.String
Joiner.MapJoiner. join(Iterable<? extends Map.Entry<?,?>> entries)
Returns a string containing the string representation of each entry inentries
, using the previously configured separator and key-value separator.String
Joiner.MapJoiner. join(Iterator<? extends Map.Entry<?,?>> entries)
Returns a string containing the string representation of each entry inentries
, using the previously configured separator and key-value separator.static List<StackTraceElement>
Throwables. lazyStackTrace(Throwable throwable)
Returns the stack trace ofthrowable
, possibly providing slower iteration over the full trace but faster iteration over parts of the trace.static boolean
Throwables. lazyStackTraceIsLazy()
Returns whetherThrowables.lazyStackTrace(java.lang.Throwable)
will use the special implementation described in its documentation.abstract T
Optional. or(Supplier<? extends T> supplier)
Returns the contained instance if it is present;supplier.get()
otherwise.static <T> Iterable<T>
Optional. presentInstances(Iterable<? extends Optional<? extends T>> optionals)
Returns the value of each present instance from the suppliedoptionals
, in order, skipping over occurrences ofOptional.absent()
.Stream<String>
Splitter. splitToStream(CharSequence sequence)
Splitssequence
into string components and makes them available through anStream
, which may be lazily evaluated.static Predicate<Class<?>>
Predicates. subtypeOf(Class<?> clazz)
Returns a predicate that evaluates totrue
if the class being tested is assignable to (is a subtype of)clazz
.Splitter.MapSplitter
Splitter. withKeyValueSeparator(char separator)
Returns aMapSplitter
which splits entries based on this splitter, and splits entries into keys and values using the specified separator.Splitter.MapSplitter
Splitter. withKeyValueSeparator(Splitter keyValueSplitter)
Returns aMapSplitter
which splits entries based on this splitter, and splits entries into keys and values using the specified key-value splitter.Splitter.MapSplitter
Splitter. withKeyValueSeparator(String separator)
Returns aMapSplitter
which splits entries based on this splitter, and splits entries into keys and values using the specified separator. -
Uses of Beta in com.google.common.collect
Classes in com.google.common.collect with annotations of type Beta Modifier and Type Class Description class
ArrayTable<R,C,V>
Fixed-sizeTable
implementation backed by a two-dimensional array.class
EvictingQueue<E>
A non-blocking queue which automatically evicts elements from the head of the queue when attempting to add new elements onto the queue and it is full.protected class
ForwardingMap.StandardEntrySet
A sensible implementation ofMap.entrySet()
in terms of the following methods:ForwardingMap.clear()
,ForwardingMap.containsKey(java.lang.Object)
,ForwardingMap.get(java.lang.Object)
,ForwardingMap.isEmpty()
,ForwardingMap.remove(java.lang.Object)
, andForwardingMap.size()
.protected class
ForwardingMap.StandardKeySet
A sensible implementation ofMap.keySet()
in terms of the following methods:ForwardingMap.clear()
,ForwardingMap.containsKey(java.lang.Object)
,ForwardingMap.isEmpty()
,ForwardingMap.remove(java.lang.Object)
,ForwardingMap.size()
, and theSet.iterator()
method ofForwardingMap.entrySet()
.protected class
ForwardingMap.StandardValues
A sensible implementation ofMap.values()
in terms of the following methods:ForwardingMap.clear()
,ForwardingMap.containsValue(java.lang.Object)
,ForwardingMap.isEmpty()
,ForwardingMap.size()
, and theSet.iterator()
method ofForwardingMap.entrySet()
.protected class
ForwardingMultiset.StandardElementSet
A sensible implementation ofMultiset.elementSet()
in terms of the following methods:ForwardingCollection.clear()
,ForwardingCollection.contains(java.lang.Object)
,ForwardingCollection.containsAll(java.util.Collection<?>)
,ForwardingMultiset.count(java.lang.Object)
,ForwardingCollection.isEmpty()
, theSet.size()
andSet.iterator()
methods ofForwardingMultiset.entrySet()
, andForwardingMultiset.remove(Object, int)
.protected class
ForwardingNavigableMap.StandardDescendingMap
A sensible implementation ofNavigableMap.descendingMap()
in terms of the methods of thisNavigableMap
.protected class
ForwardingNavigableMap.StandardNavigableKeySet
A sensible implementation ofNavigableMap.navigableKeySet()
in terms of the methods of thisNavigableMap
.protected class
ForwardingNavigableSet.StandardDescendingSet
A sensible implementation ofNavigableSet.descendingSet()
in terms of the other methods ofNavigableSet
, notably includingNavigableSet.descendingIterator()
.protected class
ForwardingSortedMap.StandardKeySet
A sensible implementation ofSortedMap.keySet()
in terms of the methods ofForwardingSortedMap
.class
ForwardingSortedMultiset<E>
A sorted multiset which forwards all its method calls to another sorted multiset.class
ImmutableRangeMap<K extends Comparable<?>,V>
ARangeMap
whose contents will never change, with many other important properties detailed atImmutableCollection
.class
ImmutableRangeSet<C extends Comparable>
ARangeSet
whose contents will never change, with many other important properties detailed atImmutableCollection
.interface
Interner<E>
Provides similar behavior toString.intern()
for any immutable type.class
Interners
Contains static methods pertaining to instances ofInterner
.class
MinMaxPriorityQueue<E>
A double-ended priority queue, which provides constant-time access to both its least element and its greatest element, as determined by the queue's specified comparator.static class
MinMaxPriorityQueue.Builder<B>
The builder class used in creation of min-max priority queues.interface
RangeMap<K extends Comparable,V>
A mapping from disjoint nonempty ranges to non-null values.interface
RangeSet<C extends Comparable>
static interface
Streams.DoubleFunctionWithIndex<R>
An analogue ofDoubleFunction
also accepting an index.static interface
Streams.FunctionWithIndex<T,R>
An analogue ofFunction
also accepting an index.static interface
Streams.IntFunctionWithIndex<R>
An analogue ofIntFunction
also accepting an index.static interface
Streams.LongFunctionWithIndex<R>
An analogue ofLongFunction
also accepting an index.class
TreeRangeMap<K extends Comparable,V>
An implementation ofRangeMap
based on aTreeMap
, supporting all optional operations.class
TreeRangeSet<C extends Comparable<?>>
class
TreeTraverser<T>
Deprecated.UseTraverser
instead.Methods in com.google.common.collect with annotations of type Beta Modifier and Type Method Description FluentIterable<E>
FluentIterable. append(E... elements)
Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable, followed byelements
.FluentIterable<E>
FluentIterable. append(Iterable<? extends E> other)
Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable, followed by those ofother
.static <K,V>
Map<K,List<V>>Multimaps. asMap(ListMultimap<K,V> multimap)
static <K,V>
Map<K,Collection<V>>Multimaps. asMap(Multimap<K,V> multimap)
Returnsmultimap.asMap()
.static <K,V>
Map<K,Set<V>>Multimaps. asMap(SetMultimap<K,V> multimap)
static <K,V>
Map<K,SortedSet<V>>Multimaps. asMap(SortedSetMultimap<K,V> multimap)
Returnsmultimap.asMap()
, with its type corrected fromMap<K, Collection<V>>
toMap<K, SortedSet<V>>
.static <K,V>
ImmutableBiMap.Builder<K,V>ImmutableBiMap. builderWithExpectedSize(int expectedSize)
Returns a new builder, expecting the specified number of entries to be added.static <E> ImmutableList.Builder<E>
ImmutableList. builderWithExpectedSize(int expectedSize)
Returns a new builder, expecting the specified number of elements to be added.static <K,V>
ImmutableMap.Builder<K,V>ImmutableMap. builderWithExpectedSize(int expectedSize)
Returns a new builder, expecting the specified number of entries to be added.static <E> ImmutableSet.Builder<E>
ImmutableSet. builderWithExpectedSize(int expectedSize)
Returns a new builder, expecting the specified number of distinct elements to be added.static List<Character>
Lists. charactersOf(CharSequence sequence)
Returns a view of the specifiedCharSequence
as aList<Character>
, viewingsequence
as a sequence of Unicode code units.static ContiguousSet<Integer>
ContiguousSet. closed(int lower, int upper)
Returns a nonempty contiguous set containing allint
values fromlower
(inclusive) toupper
(inclusive).static ContiguousSet<Long>
ContiguousSet. closed(long lower, long upper)
Returns a nonempty contiguous set containing alllong
values fromlower
(inclusive) toupper
(inclusive).static ContiguousSet<Integer>
ContiguousSet. closedOpen(int lower, int upper)
Returns a contiguous set containing allint
values fromlower
(inclusive) toupper
(exclusive).static ContiguousSet<Long>
ContiguousSet. closedOpen(long lower, long upper)
Returns a contiguous set containing alllong
values fromlower
(inclusive) toupper
(exclusive).static <E> Set<Set<E>>
Sets. combinations(Set<E> set, int size)
Returns the set of all subsets ofset
of sizesize
.static <T> FluentIterable<T>
FluentIterable. concat(Iterable<? extends Iterable<? extends T>> inputs)
Returns a fluent iterable that combines several iterables.static <T> FluentIterable<T>
FluentIterable. concat(Iterable<? extends T>... inputs)
Returns a fluent iterable that combines several iterables.static <T> FluentIterable<T>
FluentIterable. concat(Iterable<? extends T> a, Iterable<? extends T> b)
Returns a fluent iterable that combines two iterables.static <T> FluentIterable<T>
FluentIterable. concat(Iterable<? extends T> a, Iterable<? extends T> b, Iterable<? extends T> c)
Returns a fluent iterable that combines three iterables.static <T> FluentIterable<T>
FluentIterable. concat(Iterable<? extends T> a, Iterable<? extends T> b, Iterable<? extends T> c, Iterable<? extends T> d)
Returns a fluent iterable that combines four iterables.static <E> ImmutableMultiset<E>
Multisets. copyHighestCountFirst(Multiset<E> multiset)
Returns a copy ofmultiset
as anImmutableMultiset
whose iteration order is highest count first, with ties broken by the iteration order of the original multiset.static <K,V>
ImmutableBiMap<K,V>ImmutableBiMap. copyOf(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Returns an immutable bimap containing the given entries.static <K,V>
ImmutableListMultimap<K,V>ImmutableListMultimap. copyOf(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Returns an immutable multimap containing the specified entries.static <K,V>
ImmutableMap<K,V>ImmutableMap. copyOf(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Returns an immutable map containing the specified entries.static <K,V>
ImmutableMultimap<K,V>ImmutableMultimap. copyOf(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Returns an immutable multimap containing the specified entries.static <K,V>
ImmutableSetMultimap<K,V>ImmutableSetMultimap. copyOf(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Returns an immutable multimap containing the specified entries.static <K,V>
ImmutableSortedMap<K,V>ImmutableSortedMap. copyOf(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Returns an immutable map containing the given entries, with keys sorted by the provided comparator.static <K,V>
ImmutableSortedMap<K,V>ImmutableSortedMap. copyOf(Iterable<? extends Map.Entry<? extends K,? extends V>> entries, Comparator<? super K> comparator)
Returns an immutable map containing the given entries, with keys sorted by the provided comparator.static <E> ConcurrentHashMultiset<E>
ConcurrentHashMultiset. create(ConcurrentMap<E,AtomicInteger> countMap)
Creates a new, emptyConcurrentHashMultiset
usingcountMap
as the internal backing map.static <E> Multiset<E>
Multisets. difference(Multiset<E> multiset1, Multiset<?> multiset2)
Returns an unmodifiable view of the difference of two multisets.static <E> int
Queues. drain(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, long timeout, TimeUnit unit)
Drains the queue asBlockingQueue.drainTo(Collection, int)
, but if the requestednumElements
elements are not available, it will wait for them up to the specified timeout.static <E> int
Queues. drain(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, Duration timeout)
Drains the queue asBlockingQueue.drainTo(Collection, int)
, but if the requestednumElements
elements are not available, it will wait for them up to the specified timeout.static <E> int
Queues. drainUninterruptibly(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, long timeout, TimeUnit unit)
Drains the queue as Queues.drain(BlockingQueue, Collection, int, long, TimeUnit), but with a different behavior in case it is interrupted while waiting.static <E> int
Queues. drainUninterruptibly(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, Duration timeout)
Drains the queue as Queues.drain(BlockingQueue, Collection, int, Duration), but with a different behavior in case it is interrupted while waiting.static <T> Comparator<Optional<T>>
Comparators. emptiesFirst(Comparator<? super T> valueComparator)
Returns a comparator ofOptional
values which treatsOptional.empty()
as less than all other values, and orders the rest usingvalueComparator
on the contained value.static <T> Comparator<Optional<T>>
Comparators. emptiesLast(Comparator<? super T> valueComparator)
Returns a comparator ofOptional
values which treatsOptional.empty()
as greater than all other values, and orders the rest usingvalueComparator
on the contained value.static <E> Multiset<E>
Multisets. filter(Multiset<E> unfiltered, Predicate<? super E> predicate)
Returns a view of the elements ofunfiltered
that satisfy a predicate.static OptionalDouble
Streams. findLast(DoubleStream stream)
Returns the last element of the specified stream, orOptionalDouble.empty()
if the stream is empty.static OptionalInt
Streams. findLast(IntStream stream)
Returns the last element of the specified stream, orOptionalInt.empty()
if the stream is empty.static OptionalLong
Streams. findLast(LongStream stream)
Returns the last element of the specified stream, orOptionalLong.empty()
if the stream is empty.static <T> Optional<T>
Streams. findLast(Stream<T> stream)
Returns the last element of the specified stream, orOptional.empty()
if the stream is empty.static <T,K,V,M extends Multimap<K,V>>
Collector<T,?,M>Multimaps. flatteningToMultimap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends Stream<? extends V>> valueFunction, Supplier<M> multimapSupplier)
Returns aCollector
accumulating entries into aMultimap
generated from the specified supplier.default void
Multiset. forEachEntry(ObjIntConsumer<? super E> action)
Runs the specified action for each distinct element in this multiset, and the number of occurrences of that element.static <A,B>
voidStreams. forEachPair(Stream<A> streamA, Stream<B> streamB, BiConsumer<? super A,? super B> consumer)
Invokesconsumer
once for each pair of corresponding elements instreamA
andstreamB
.static <E> FluentIterable<E>
FluentIterable. from(E[] elements)
Returns a fluent iterable containingelements
in the specified order.static <T> boolean
Comparators. isInOrder(Iterable<? extends T> iterable, Comparator<T> comparator)
Returnstrue
if each element initerable
after the first is greater than or equal to the element that preceded it, according to the specified comparator.static <T> boolean
Comparators. isInStrictOrder(Iterable<? extends T> iterable, Comparator<T> comparator)
Returnstrue
if each element initerable
after the first is strictly greater than the element that preceded it, according to the specified comparator.String
FluentIterable. join(Joiner joiner)
Returns aString
containing all of the elements of this fluent iterable joined withjoiner
.static <T,S extends T>
Comparator<Iterable<S>>Comparators. lexicographical(Comparator<T> comparator)
Returns a new comparator which sorts iterables by comparing corresponding elements pairwise until a nonzero result is found; imposes "dictionary order." If the end of one iterable is reached, but not the other, the shorter iterable is considered to be less than the longer one.static <R> Stream<R>
Streams. mapWithIndex(DoubleStream stream, Streams.DoubleFunctionWithIndex<R> function)
Returns a stream consisting of the results of applying the given function to the elements ofstream
and their indexes in the stream.static <R> Stream<R>
Streams. mapWithIndex(IntStream stream, Streams.IntFunctionWithIndex<R> function)
Returns a stream consisting of the results of applying the given function to the elements ofstream
and their indexes in the stream.static <R> Stream<R>
Streams. mapWithIndex(LongStream stream, Streams.LongFunctionWithIndex<R> function)
Returns a stream consisting of the results of applying the given function to the elements ofstream
and their indexes in the stream.static <T,R>
Stream<R>Streams. mapWithIndex(Stream<T> stream, Streams.FunctionWithIndex<? super T,? extends R> function)
Returns a stream consisting of the results of applying the given function to the elements ofstream
and their indices in the stream.static <T> T
Comparators. max(@Nullable T a, @Nullable T b, Comparator<T> comparator)
Returns the maximum of the two values, according to the given comparator.static <T extends Comparable<? super T>>
TComparators. max(T a, T b)
Returns the maximum of the two values.static <T> Iterable<T>
Iterables. mergeSorted(Iterable<? extends Iterable<? extends T>> iterables, Comparator<? super T> comparator)
Returns an iterable over the merged contents of all giveniterables
.static <T> UnmodifiableIterator<T>
Iterators. mergeSorted(Iterable<? extends Iterator<? extends T>> iterators, Comparator<? super T> comparator)
Returns an iterator over the merged contents of all giveniterators
, traversing every element of the input iterators.static <T> T
Comparators. min(@Nullable T a, @Nullable T b, Comparator<T> comparator)
Returns the minimum of the two values, according to the given comparator.static <T extends Comparable<? super T>>
TComparators. min(T a, T b)
Returns the minimum of the two values.static <R,C,V>
Table<R,C,V>Tables. newCustomTable(Map<R,Map<C,V>> backingMap, Supplier<? extends Map<C,V>> factory)
Creates a table that uses the specified backing map and factory.static <E> FluentIterable<E>
FluentIterable. of()
Returns a fluent iterable containing no elements.static <E> FluentIterable<E>
FluentIterable. of(@Nullable E element, E... elements)
Returns a fluent iterable containing the specified elements in order.static <E extends Comparable<? super E>>
Collection<List<E>>Collections2. orderedPermutations(Iterable<E> elements)
Returns aCollection
of all the permutations of the specifiedIterable
.static <E> Collection<List<E>>
Collections2. orderedPermutations(Iterable<E> elements, Comparator<? super E> comparator)
Returns aCollection
of all the permutations of the specifiedIterable
using the specifiedComparator
for establishing the lexicographical ordering.ImmutableBiMap.Builder<K,V>
ImmutableBiMap.Builder. orderEntriesByValue(Comparator<? super V> valueComparator)
Configures thisBuilder
to order entries by value according to the specified comparator.ImmutableMap.Builder<K,V>
ImmutableMap.Builder. orderEntriesByValue(Comparator<? super V> valueComparator)
Configures thisBuilder
to order entries by value according to the specified comparator.ImmutableSortedMap.Builder<K,V>
ImmutableSortedMap.Builder. orderEntriesByValue(Comparator<? super V> valueComparator)
Deprecated.Unsupported by ImmutableSortedMap.Builder.static <E> Collection<List<E>>
Collections2. permutations(Collection<E> elements)
Returns aCollection
of all the permutations of the specifiedCollection
.ImmutableBiMap.Builder<K,V>
ImmutableBiMap.Builder. putAll(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Adds all of the given entries to the built bimap.ImmutableListMultimap.Builder<K,V>
ImmutableListMultimap.Builder. putAll(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Adds entries to the built multimap.ImmutableMap.Builder<K,V>
ImmutableMap.Builder. putAll(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Adds all of the given entries to the built map.ImmutableMultimap.Builder<K,V>
ImmutableMultimap.Builder. putAll(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Adds entries to the built multimap.ImmutableSetMultimap.Builder<K,V>
ImmutableSetMultimap.Builder. putAll(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Adds entries to the built multimap.ImmutableSortedMap.Builder<K,V>
ImmutableSortedMap.Builder. putAll(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Adds all the given entries to the built map.protected boolean
ForwardingMultiset. standardAddAll(Collection<? extends E> elementsToAdd)
A sensible definition ofForwardingCollection.addAll(Collection)
in terms ofForwardingCollection.add(Object)
andForwardingMultiset.add(Object, int)
.protected boolean
ForwardingSortedSet. standardContains(@Nullable Object object)
A sensible definition ofForwardingCollection.contains(java.lang.Object)
in terms of thefirst()
method ofForwardingSortedSet.tailSet(E)
.protected boolean
ForwardingMap. standardContainsKey(@Nullable Object key)
A sensible, albeit inefficient, definition ofForwardingMap.containsKey(java.lang.Object)
in terms of theiterator
method ofForwardingMap.entrySet()
.protected boolean
ForwardingSortedMap. standardContainsKey(@Nullable Object key)
A sensible definition ofForwardingMap.containsKey(java.lang.Object)
in terms of thefirstKey()
method ofForwardingSortedMap.tailMap(K)
.protected int
ForwardingMultiset. standardCount(@Nullable Object object)
A sensible, albeit inefficient, definition ofForwardingMultiset.count(java.lang.Object)
in terms ofForwardingMultiset.entrySet()
.protected NavigableSet<K>
ForwardingNavigableMap. standardDescendingKeySet()
A sensible definition ofForwardingNavigableMap.descendingKeySet()
as thenavigableKeySet
ofForwardingNavigableMap.descendingMap()
.protected boolean
ForwardingList. standardEquals(@Nullable Object object)
A sensible definition ofForwardingList.equals(Object)
in terms ofForwardingCollection.size()
andForwardingCollection.iterator()
.protected int
ForwardingList. standardHashCode()
A sensible definition ofForwardingList.hashCode()
in terms ofForwardingCollection.iterator()
.protected ListIterator<E>
ForwardingList. standardListIterator(int start)
A sensible default implementation ofForwardingList.listIterator(int)
, in terms ofForwardingCollection.size()
,ForwardingList.get(int)
,ForwardingList.set(int, Object)
,ForwardingList.add(int, Object)
, andForwardingList.remove(int)
.protected V
ForwardingMap. standardRemove(@Nullable Object key)
A sensible, albeit inefficient, definition ofForwardingMap.remove(java.lang.Object)
in terms of theiterator
method ofForwardingMap.entrySet()
.protected boolean
ForwardingSortedSet. standardRemove(@Nullable Object object)
A sensible definition ofForwardingCollection.remove(java.lang.Object)
in terms of theiterator()
method ofForwardingSortedSet.tailSet(E)
.protected List<E>
ForwardingList. standardSubList(int fromIndex, int toIndex)
A sensible default implementation ofForwardingList.subList(int, int)
.protected SortedMap<K,V>
ForwardingSortedMap. standardSubMap(K fromKey, K toKey)
A sensible default implementation ofForwardingSortedMap.subMap(Object, Object)
in terms ofForwardingSortedMap.headMap(Object)
andForwardingSortedMap.tailMap(Object)
.protected NavigableSet<E>
ForwardingNavigableSet. standardSubSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
A sensible definition ofForwardingNavigableSet.subSet(Object, boolean, Object, boolean)
in terms of theheadSet
andtailSet
methods.protected SortedSet<E>
ForwardingSortedSet. standardSubSet(E fromElement, E toElement)
A sensible default implementation ofForwardingSortedSet.subSet(Object, Object)
in terms ofForwardingSortedSet.headSet(Object)
andForwardingSortedSet.tailSet(Object)
.protected String
ForwardingMapEntry. standardToString()
A sensible definition ofForwardingObject.toString()
in terms ofForwardingMapEntry.getKey()
andForwardingMapEntry.getValue()
.static <T> Stream<T>
Streams. stream(Optional<T> optional)
If a value is present inoptional
, returns a stream containing only that element, otherwise returns an empty stream.static <T> Stream<T>
Streams. stream(Collection<T> collection)
Deprecated.There is no reason to use this; just invokecollection.stream()
directly.static <T> Stream<T>
Streams. stream(Iterator<T> iterator)
Returns a sequentialStream
of the remaining contents ofiterator
.static <T> Stream<T>
Streams. stream(Optional<T> optional)
If a value is present inoptional
, returns a stream containing only that element, otherwise returns an empty stream.static DoubleStream
Streams. stream(OptionalDouble optional)
If a value is present inoptional
, returns a stream containing only that element, otherwise returns an empty stream.static IntStream
Streams. stream(OptionalInt optional)
If a value is present inoptional
, returns a stream containing only that element, otherwise returns an empty stream.static LongStream
Streams. stream(OptionalLong optional)
If a value is present inoptional
, returns a stream containing only that element, otherwise returns an empty stream.static <K extends Comparable<? super K>,V>
NavigableMap<K,V>Maps. subMap(NavigableMap<K,V> map, Range<K> range)
Returns a view of the portion ofmap
whose keys are contained byrange
.static <K extends Comparable<? super K>>
NavigableSet<K>Sets. subSet(NavigableSet<K> set, Range<K> range)
Returns a view of the portion ofset
whose elements are contained byrange
.static <E> Multiset<E>
Multisets. sum(Multiset<? extends E> multiset1, Multiset<? extends E> multiset2)
Returns an unmodifiable view of the sum of two multisets.static <T,R,C,V,I extends Table<R,C,V>>
Collector<T,?,I>Tables. toTable(Function<? super T,? extends R> rowFunction, Function<? super T,? extends C> columnFunction, Function<? super T,? extends V> valueFunction, Supplier<I> tableSupplier)
Returns aCollector
that accumulates elements into aTable
created using the specified supplier, whose cells are generated by applying the provided mapping functions to the input elements.static <R,C,V1,V2>
Table<R,C,V2>Tables. transformValues(Table<R,C,V1> fromTable, Function<? super V1,V2> function)
Returns a view of a table where each value is transformed by a function.static <E> Multiset<E>
Multisets. union(Multiset<? extends E> multiset1, Multiset<? extends E> multiset2)
Returns an unmodifiable view of the union of two multisets.static <R,C,V>
RowSortedTable<R,C,V>Tables. unmodifiableRowSortedTable(RowSortedTable<R,? extends C,? extends V> table)
Returns an unmodifiable view of the specified row-sorted table.static <E> SortedMultiset<E>
Multisets. unmodifiableSortedMultiset(SortedMultiset<E> sortedMultiset)
Returns an unmodifiable view of the specified sorted multiset.static <A,B,R>
Stream<R>Streams. zip(Stream<A> streamA, Stream<B> streamB, BiFunction<? super A,? super B,R> function)
Returns a stream in which each element is the result of passing the corresponding element of each ofstreamA
andstreamB
tofunction
. -
Uses of Beta in com.google.common.escape
Classes in com.google.common.escape with annotations of type Beta Modifier and Type Class Description class
ArrayBasedCharEscaper
ACharEscaper
that uses an array to quickly look up replacement characters for a givenchar
value.class
ArrayBasedEscaperMap
An implementation-specific parameter class suitable for initializingArrayBasedCharEscaper
orArrayBasedUnicodeEscaper
instances.class
ArrayBasedUnicodeEscaper
AUnicodeEscaper
that uses an array to quickly look up replacement characters for a given code point.class
CharEscaper
An object that converts literal text into a format safe for inclusion in a particular context (such as an XML document).class
CharEscaperBuilder
Simple helper class to build a "sparse" array of objects based on the indexes that were added to it.class
Escapers
Static utility methods pertaining toEscaper
instances.static class
Escapers.Builder
A builder for simple, fast escapers.class
UnicodeEscaper
AnEscaper
that converts literal text into a format safe for inclusion in a particular context (such as an XML document). -
Uses of Beta in com.google.common.eventbus
Classes in com.google.common.eventbus with annotations of type Beta Modifier and Type Class Description interface
AllowConcurrentEvents
Marks an event subscriber method as being thread-safe.class
AsyncEventBus
AnEventBus
that takes the Executor of your choice and uses it to dispatch events, allowing dispatch to occur asynchronously.class
DeadEvent
Wraps an event that was posted, but which had no subscribers and thus could not be delivered.class
EventBus
Dispatches events to listeners, and provides ways for listeners to register themselves.interface
Subscribe
Marks a method as an event subscriber. -
Uses of Beta in com.google.common.graph
Classes in com.google.common.graph with annotations of type Beta Modifier and Type Class Description class
AbstractGraph<N>
This class provides a skeletal implementation ofGraph
.class
AbstractNetwork<N,E>
This class provides a skeletal implementation ofNetwork
.class
AbstractValueGraph<N,V>
This class provides a skeletal implementation ofValueGraph
.class
ElementOrder<T>
Used to represent the order of elements in a data structure that supports different options for iteration order guarantees.class
EndpointPair<N>
An immutable pair representing the two endpoints of an edge in a graph.interface
Graph<N>
An interface for graph-structured data, whose edges are anonymous entities with no identity or information of their own.class
GraphBuilder<N>
A builder for constructing instances ofMutableGraph
orImmutableGraph
with user-defined properties.class
Graphs
class
ImmutableGraph<N>
AGraph
whose elements and structural relationships will never change.class
ImmutableNetwork<N,E>
ANetwork
whose elements and structural relationships will never change.class
ImmutableValueGraph<N,V>
AValueGraph
whose elements and structural relationships will never change.interface
MutableGraph<N>
A subinterface ofGraph
which adds mutation methods.interface
MutableNetwork<N,E>
A subinterface ofNetwork
which adds mutation methods.interface
MutableValueGraph<N,V>
A subinterface ofValueGraph
which adds mutation methods.interface
Network<N,E>
An interface for graph-structured data, whose edges are unique objects.class
NetworkBuilder<N,E>
A builder for constructing instances ofMutableNetwork
orImmutableNetwork
with user-defined properties.interface
PredecessorsFunction<N>
A functional interface for graph-structured data.interface
SuccessorsFunction<N>
A functional interface for graph-structured data.class
Traverser<N>
An object that can traverse the nodes that are reachable from a specified (set of) start node(s) using a specifiedSuccessorsFunction
.interface
ValueGraph<N,V>
An interface for graph-structured data, whose edges have associated non-unique values.class
ValueGraphBuilder<N,V>
A builder for constructing instances ofMutableValueGraph
orImmutableValueGraph
with user-defined properties. -
Uses of Beta in com.google.common.hash
Classes in com.google.common.hash with annotations of type Beta Modifier and Type Class Description class
BloomFilter<T>
A Bloom filter for instances ofT
.interface
Funnel<T>
An object which can send data from an object of typeT
into aPrimitiveSink
.class
Funnels
Funnels for common types.class
HashCode
An immutable hash code of arbitrary bit length.interface
Hasher
APrimitiveSink
that can compute a hash code after reading the input.interface
HashFunction
A hash function is a collision-averse pure function that maps an arbitrary block of data to a number called a hash code.class
Hashing
Static methods to obtainHashFunction
instances, and other static hashing-related utilities.class
HashingInputStream
AnInputStream
that maintains a hash of the data read from it.class
HashingOutputStream
AnOutputStream
that maintains a hash of the data written to it.interface
PrimitiveSink
An object which can receive a stream of primitive values. -
Uses of Beta in com.google.common.io
Classes in com.google.common.io with annotations of type Beta Modifier and Type Interface Description interface
ByteProcessor<T>
A callback interface to process bytes from a stream.class
Closeables
Utility methods for working withCloseable
objects.class
Closer
class
CountingInputStream
AnInputStream
that counts the number of bytes read.class
CountingOutputStream
An OutputStream that counts the number of bytes written.class
FileBackedOutputStream
AnOutputStream
that starts buffering to a byte array, but switches to file buffering once the data reaches a configurable size.class
Flushables
Utility methods for working withFlushable
objects.class
InsecureRecursiveDeleteException
Exception indicating that a recursive delete can't be performed because the file system does not have the support necessary to guarantee that it is not vulnerable to race conditions that would allow it to delete files and directories outside of the directory being deleted (i.e.,SecureDirectoryStream
is not supported).interface
LineProcessor<T>
A callback to be used with the streamingreadLines
methods.class
LineReader
A class for reading lines of text.class
LittleEndianDataInputStream
An implementation ofDataInput
that uses little-endian byte ordering for readingshort
,int
,float
,double
, andlong
values.class
LittleEndianDataOutputStream
An implementation ofDataOutput
that uses little-endian byte ordering for writingchar
,short
,int
,float
,double
, andlong
values.class
MoreFiles
class
PatternFilenameFilter
File name filter that only accepts files matching a regular expression.class
RecursiveDeleteOption
Options for use with recursive delete methods (MoreFiles.deleteRecursively(java.nio.file.Path, com.google.common.io.RecursiveDeleteOption...)
andMoreFiles.deleteDirectoryContents(java.nio.file.Path, com.google.common.io.RecursiveDeleteOption...)
).class
Resources
Provides utility methods for working with resources in the classpath.Methods in com.google.common.io with annotations of type Beta Modifier and Type Method Description static void
Files. append(CharSequence from, File to, Charset charset)
Deprecated.PreferasCharSink(to, charset, FileWriteMode.APPEND).write(from)
.ByteSource
CharSource. asByteSource(Charset charset)
Returns aByteSource
view of this char source that encodes chars read from this source as bytes using the givenCharset
.static Writer
CharStreams. asWriter(Appendable target)
Returns a Writer that sends all output to the givenAppendable
target.static void
Files. copy(File from, File to)
Copies all the bytes from one file to another.static void
Files. copy(File from, OutputStream to)
Copies all bytes from a file to an output stream.static void
Files. copy(File from, Charset charset, Appendable to)
Deprecated.PreferasCharSource(from, charset).copyTo(to)
.static void
Files. createParentDirs(File file)
Creates any necessary but nonexistent parent directories of the specified file.static File
Files. createTempDir()
Deprecated.For Android users, see the Data and File Storage overview to select an appropriate temporary directory (perhapscontext.getCacheDir()
).static boolean
Files. equal(File file1, File file2)
Returns true if the given files exist, are not directories, and contain the same bytes.static long
ByteStreams. exhaust(InputStream in)
Reads and discards data from the givenInputStream
until the end of the stream is reached.static long
CharStreams. exhaust(Readable readable)
Reads and discards data from the givenReadable
until the end of the stream is reached.static Traverser<File>
Files. fileTraverser()
Returns aTraverser
instance for the file and directory tree.void
CharSource. forEachLine(Consumer<? super String> action)
Reads all lines of text from this source, running the givenaction
for each line as it is read.static String
Files. getFileExtension(String fullName)
Returns the file extension for the given file name, or the empty string if the file has no extension.static String
Files. getNameWithoutExtension(String file)
Returns the file name without its file extension or path.static HashCode
Files. hash(File file, HashFunction hashFunction)
Deprecated.PreferasByteSource(file).hash(hashFunction)
.static Predicate<File>
Files. isDirectory()
Returns a predicate that returns the result ofFile.isDirectory()
on input files.static Predicate<File>
Files. isFile()
Returns a predicate that returns the result ofFile.isFile()
on input files.long
CharSource. length()
Returns the length of this source in chars, even if doing so requires opening and traversing an entire stream.Optional<Long>
CharSource. lengthIfKnown()
Returns the size of this source in chars, if the size can be easily determined without actually opening the data stream.static InputStream
ByteStreams. limit(InputStream in, long limit)
Wraps aInputStream
, limiting the number of bytes which can be read.Stream<String>
CharSource. lines()
Opens a newStream
for reading text one line at a time from this source.static MappedByteBuffer
Files. map(File file)
Fully maps a file read-only in to memory as perFileChannel.map(java.nio.channels.FileChannel.MapMode, long, long)
.static MappedByteBuffer
Files. map(File file, FileChannel.MapMode mode)
Fully maps a file in to memory as perFileChannel.map(java.nio.channels.FileChannel.MapMode, long, long)
using the requestedFileChannel.MapMode
.static MappedByteBuffer
Files. map(File file, FileChannel.MapMode mode, long size)
Maps a file in to memory as perFileChannel.map(java.nio.channels.FileChannel.MapMode, long, long)
using the requestedFileChannel.MapMode
.static void
Files. move(File from, File to)
Moves a file from one path to another.static ByteArrayDataInput
ByteStreams. newDataInput(byte[] bytes)
Returns a newByteArrayDataInput
instance to read from thebytes
array from the beginning.static ByteArrayDataInput
ByteStreams. newDataInput(byte[] bytes, int start)
Returns a newByteArrayDataInput
instance to read from thebytes
array, starting at the given position.static ByteArrayDataInput
ByteStreams. newDataInput(ByteArrayInputStream byteArrayInputStream)
Returns a newByteArrayDataInput
instance to read from the givenByteArrayInputStream
.static ByteArrayDataOutput
ByteStreams. newDataOutput()
Returns a newByteArrayDataOutput
instance with a default size.static ByteArrayDataOutput
ByteStreams. newDataOutput(int size)
Returns a newByteArrayDataOutput
instance sized to holdsize
bytes before resizing.static ByteArrayDataOutput
ByteStreams. newDataOutput(ByteArrayOutputStream byteArrayOutputStream)
Returns a newByteArrayDataOutput
instance which writes to the givenByteArrayOutputStream
.static BufferedReader
Files. newReader(File file, Charset charset)
Returns a buffered reader that reads from a file using the given character set.static BufferedWriter
Files. newWriter(File file, Charset charset)
Returns a buffered writer that writes to a file using the given character set.static OutputStream
ByteStreams. nullOutputStream()
Returns anOutputStream
that simply discards written bytes.static Writer
CharStreams. nullWriter()
Returns aWriter
that simply discards written chars.<T> T
ByteSource. read(ByteProcessor<T> processor)
Reads the contents of this byte source using the givenprocessor
to process bytes as they are read.static int
ByteStreams. read(InputStream in, byte[] b, int off, int len)
Reads some bytes from an input stream and stores them into the buffer arrayb
.static <T> T
ByteStreams. readBytes(InputStream input, ByteProcessor<T> processor)
Process the bytes of the given input stream using the given processor.static <T> T
Files. readBytes(File file, ByteProcessor<T> processor)
Deprecated.PreferasByteSource(file).read(processor)
.static String
Files. readFirstLine(File file, Charset charset)
Deprecated.PreferasCharSource(file, charset).readFirstLine()
.static void
ByteStreams. readFully(InputStream in, byte[] b)
Attempts to read enough bytes from the stream to fill the given byte array, with the same behavior asDataInput.readFully(byte[])
.static void
ByteStreams. readFully(InputStream in, byte[] b, int off, int len)
Attempts to readlen
bytes from the stream into the given array starting atoff
, with the same behavior asDataInput.readFully(byte[], int, int)
.<T> T
CharSource. readLines(LineProcessor<T> processor)
Reads lines of text from this source, processing each line as it is read using the givenprocessor
.static List<String>
CharStreams. readLines(Readable r)
Reads all of the lines from aReadable
object.static <T> T
CharStreams. readLines(Readable readable, LineProcessor<T> processor)
Streams lines from aReadable
object, stopping when the processor returnsfalse
or all lines have been read and returning the result produced by the processor.static List<String>
Files. readLines(File file, Charset charset)
Reads all of the lines from a file.static <T> T
Files. readLines(File file, Charset charset, LineProcessor<T> callback)
Deprecated.PreferasCharSource(file, charset).readLines(callback)
.static String
Files. simplifyPath(String pathname)
Returns the lexically cleaned form of the path name, usually (but not always) equivalent to the original.Optional<Long>
ByteSource. sizeIfKnown()
Returns the size of this source in bytes, if the size can be easily determined without actually opening the data stream.static void
ByteStreams. skipFully(InputStream in, long n)
Discardsn
bytes of data from the input stream.static void
CharStreams. skipFully(Reader reader, long n)
Discardsn
characters of data from the reader.static byte[]
Files. toByteArray(File file)
Reads all bytes from a file into a byte array.static String
Files. toString(File file, Charset charset)
Deprecated.PreferasCharSource(file, charset).read()
.static void
Files. touch(File file)
Creates an empty file or updates the last updated timestamp on the same as the unix command of the same name.static void
Files. write(byte[] from, File to)
Overwrites a file with the contents of a byte array.static void
Files. write(CharSequence from, File to, Charset charset)
Deprecated.PreferasCharSink(to, charset).write(from)
.void
CharSink. writeLines(Stream<? extends CharSequence> lines)
Writes the given lines of text to this sink with each line (including the last) terminated with the operating system's default line separator.void
CharSink. writeLines(Stream<? extends CharSequence> lines, String lineSeparator)
Writes the given lines of text to this sink with each line (including the last) terminated with the given line separator. -
Uses of Beta in com.google.common.math
Classes in com.google.common.math with annotations of type Beta Modifier and Type Class Description class
LinearTransformation
The representation of a linear transformation between real numbersx
andy
.class
PairedStats
An immutable value object capturing some basic statistics about a collection of paired double values (e.g.class
PairedStatsAccumulator
A mutable object which accumulates paired double values (e.g.class
Quantiles
Provides a fluent API for calculating quantiles.class
Stats
A bundle of statistical summary values -- sum, count, mean/average, min and max, and several forms of variance -- that were computed from a single set of zero or more floating-point values.class
StatsAccumulator
A mutable object which accumulates double values and tracks some basic statistics over all the values added so far.Methods in com.google.common.math with annotations of type Beta Modifier and Type Method Description static BigInteger
BigIntegerMath. ceilingPowerOfTwo(BigInteger x)
Returns the smallest power of two greater than or equal tox
.static int
IntMath. ceilingPowerOfTwo(int x)
Returns the smallest power of two greater than or equal tox
.static long
LongMath. ceilingPowerOfTwo(long x)
Returns the smallest power of two greater than or equal tox
.static BigInteger
BigIntegerMath. floorPowerOfTwo(BigInteger x)
Returns the largest power of two less than or equal tox
.static int
IntMath. floorPowerOfTwo(int x)
Returns the largest power of two less than or equal tox
.static long
LongMath. floorPowerOfTwo(long x)
Returns the largest power of two less than or equal tox
.static boolean
IntMath. isPrime(int n)
Returnstrue
ifn
is a prime number: an integer greater than one that cannot be factored into a product of smaller positive integers.static boolean
LongMath. isPrime(long n)
Returnstrue
ifn
is a prime number: an integer greater than one that cannot be factored into a product of smaller positive integers.static int
IntMath. saturatedAdd(int a, int b)
Returns the sum ofa
andb
unless it would overflow or underflow in which caseInteger.MAX_VALUE
orInteger.MIN_VALUE
is returned, respectively.static long
LongMath. saturatedAdd(long a, long b)
Returns the sum ofa
andb
unless it would overflow or underflow in which caseLong.MAX_VALUE
orLong.MIN_VALUE
is returned, respectively.static int
IntMath. saturatedMultiply(int a, int b)
Returns the product ofa
andb
unless it would overflow or underflow in which caseInteger.MAX_VALUE
orInteger.MIN_VALUE
is returned, respectively.static long
LongMath. saturatedMultiply(long a, long b)
Returns the product ofa
andb
unless it would overflow or underflow in which caseLong.MAX_VALUE
orLong.MIN_VALUE
is returned, respectively.static int
IntMath. saturatedPow(int b, int k)
Returns theb
to thek
th power, unless it would overflow or underflow in which caseInteger.MAX_VALUE
orInteger.MIN_VALUE
is returned, respectively.static long
LongMath. saturatedPow(long b, int k)
Returns theb
to thek
th power, unless it would overflow or underflow in which caseLong.MAX_VALUE
orLong.MIN_VALUE
is returned, respectively.static int
IntMath. saturatedSubtract(int a, int b)
Returns the difference ofa
andb
unless it would overflow or underflow in which caseInteger.MAX_VALUE
orInteger.MIN_VALUE
is returned, respectively.static long
LongMath. saturatedSubtract(long a, long b)
Returns the difference ofa
andb
unless it would overflow or underflow in which caseLong.MAX_VALUE
orLong.MIN_VALUE
is returned, respectively. -
Uses of Beta in com.google.common.net
Classes in com.google.common.net with annotations of type Beta Modifier and Type Class Description class
HostAndPort
An immutable representation of a host and port.class
HostSpecifier
A syntactically valid host specifier, suitable for use in a URI.class
InetAddresses
Static utility methods pertaining toInetAddress
instances.static class
InetAddresses.TeredoInfo
A simple immutable data class to encapsulate the information to be found in a Teredo address.class
InternetDomainName
An immutable well-formed internet domain name, such ascom
orfoo.co.uk
.class
MediaType
Represents an Internet Media Type (also known as a MIME Type or Content Type).class
PercentEscaper
AUnicodeEscaper
that escapes some set of Java characters using a UTF-8 based percent encoding scheme.Fields in com.google.common.net with annotations of type Beta Modifier and Type Field Description static String
HttpHeaders. FOLLOW_ONLY_WHEN_PRERENDER_SHOWN
The HTTPFollow-Only-When-Prerender-Shown
header field name.static String
HttpHeaders. PUBLIC_KEY_PINS
The HTTPPublic-Key-Pins
header field name.static String
HttpHeaders. PUBLIC_KEY_PINS_REPORT_ONLY
The HTTPPublic-Key-Pins-Report-Only
header field name.static String
HttpHeaders. SOURCE_MAP
The HTTPSourceMap
header field name.static String
HttpHeaders. X_DOWNLOAD_OPTIONS
The HTTPX-Download-Options
header field name. -
Uses of Beta in com.google.common.primitives
Classes in com.google.common.primitives with annotations of type Beta Modifier and Type Class Description class
ImmutableDoubleArray
An immutable array ofdouble
values, with an API resemblingList
.class
ImmutableIntArray
An immutable array ofint
values, with an API resemblingList
.class
ImmutableLongArray
An immutable array oflong
values, with an API resemblingList
.class
UnsignedInts
Static utility methods pertaining toint
primitives that interpret values as unsigned (that is, any negative valuex
is treated as the positive value2^32 + x
).class
UnsignedLongs
Static utility methods pertaining tolong
primitives that interpret values as unsigned (that is, any negative valuex
is treated as the positive value2^64 + x
).Methods in com.google.common.primitives with annotations of type Beta Modifier and Type Method Description static char
Chars. constrainToRange(char value, char min, char max)
Returns the value nearest tovalue
which is within the closed range[min..max]
.static double
Doubles. constrainToRange(double value, double min, double max)
Returns the value nearest tovalue
which is within the closed range[min..max]
.static float
Floats. constrainToRange(float value, float min, float max)
Returns the value nearest tovalue
which is within the closed range[min..max]
.static int
Ints. constrainToRange(int value, int min, int max)
Returns the value nearest tovalue
which is within the closed range[min..max]
.static long
Longs. constrainToRange(long value, long min, long max)
Returns the value nearest tovalue
which is within the closed range[min..max]
.static short
Shorts. constrainToRange(short value, short min, short max)
Returns the value nearest tovalue
which is within the closed range[min..max]
.static int
Booleans. countTrue(boolean... values)
Returns the number ofvalues
that aretrue
.static Comparator<Boolean>
Booleans. falseFirst()
Returns aComparator<Boolean>
that sortsfalse
beforetrue
.static byte
UnsignedBytes. parseUnsignedByte(String string)
Returns the unsignedbyte
value represented by the given decimal string.static byte
UnsignedBytes. parseUnsignedByte(String string, int radix)
Returns the unsignedbyte
value represented by a string with the given radix.static Converter<String,Double>
Doubles. stringConverter()
Returns a serializable converter object that converts between strings and doubles usingDouble.valueOf(java.lang.String)
andDouble.toString()
.static Converter<String,Float>
Floats. stringConverter()
Returns a serializable converter object that converts between strings and floats usingFloat.valueOf(java.lang.String)
andFloat.toString()
.static Converter<String,Integer>
Ints. stringConverter()
Returns a serializable converter object that converts between strings and integers usingInteger.decode(java.lang.String)
andInteger.toString()
.static Converter<String,Long>
Longs. stringConverter()
Returns a serializable converter object that converts between strings and longs usingLong.decode(java.lang.String)
andLong.toString()
.static Converter<String,Short>
Shorts. stringConverter()
Returns a serializable converter object that converts between strings and shorts usingShort.decode(java.lang.String)
andShort.toString()
.static String
UnsignedBytes. toString(byte x)
Returns a string representation of x, where x is treated as unsigned.static String
UnsignedBytes. toString(byte x, int radix)
Returns a string representation ofx
for the given radix, wherex
is treated as unsigned.static Comparator<Boolean>
Booleans. trueFirst()
Returns aComparator<Boolean>
that sortstrue
beforefalse
.static @Nullable Double
Doubles. tryParse(String string)
Parses the specified string as a double-precision floating point value.static @Nullable Float
Floats. tryParse(String string)
Parses the specified string as a single-precision floating point value.static @Nullable Integer
Ints. tryParse(String string)
Parses the specified string as a signed decimal integer value.static @Nullable Integer
Ints. tryParse(String string, int radix)
Parses the specified string as a signed integer value using the specified radix.static @Nullable Long
Longs. tryParse(String string)
Parses the specified string as a signed decimal long value.static @Nullable Long
Longs. tryParse(String string, int radix)
Parses the specified string as a signed long value using the specified radix. -
Uses of Beta in com.google.common.reflect
Classes in com.google.common.reflect with annotations of type Beta Modifier and Type Class Description class
AbstractInvocationHandler
Abstract implementation ofInvocationHandler
that handlesObject.equals(java.lang.Object)
,Object.hashCode()
andObject.toString()
.class
ClassPath
Scans the source of aClassLoader
and finds all loadable classes and resources.static class
ClassPath.ClassInfo
Represents a class that can be loaded throughClassPath.ClassInfo.load()
.static class
ClassPath.ResourceInfo
Represents a class path resource that can be either a class file or any other resource file loadable from the class path.class
ImmutableTypeToInstanceMap<B>
A type-to-instance map backed by anImmutableMap
.static class
ImmutableTypeToInstanceMap.Builder<B>
A builder for creating immutable type-to-instance maps.class
Invokable<T,R>
Wrapper around either aMethod
or aConstructor
.class
MutableTypeToInstanceMap<B>
A mutable type-to-instance map.class
Parameter
Represents a method or constructor parameter.class
Reflection
Static utilities relating to Java reflection.class
TypeParameter<T>
Captures a free type variable that can be used inTypeToken.where(com.google.common.reflect.TypeParameter<X>, com.google.common.reflect.TypeToken<X>)
.class
TypeResolver
An object of this class encapsulates type mappings from type variables.interface
TypeToInstanceMap<B>
A map, each entry of which maps aTypeToken
to an instance of that type.class
TypeToken<T>
AType
with generics. -
Uses of Beta in com.google.common.util.concurrent
Classes in com.google.common.util.concurrent with annotations of type Beta Modifier and Type Class Description class
AbstractListeningExecutorService
AbstractListeningExecutorService
implementation that createsListenableFuture
instances for eachRunnable
andCallable
submitted to it.interface
AsyncCallable<V>
Computes a value, possibly asynchronously.class
ClosingFuture<V>
A step in a pipeline of an asynchronous computation.class
CycleDetectingLockFactory
TheCycleDetectingLockFactory
createsReentrantLock
instances andReentrantReadWriteLock
instances that detect potential deadlock by checking for cycles in lock acquisition order.static class
CycleDetectingLockFactory.Policies
Pre-definedCycleDetectingLockFactory.Policy
implementations.static interface
CycleDetectingLockFactory.Policy
Encapsulates the action to be taken when a potential deadlock is encountered.static class
CycleDetectingLockFactory.PotentialDeadlockException
Represents a detected cycle in lock acquisition ordering.static class
CycleDetectingLockFactory.WithExplicitOrdering<E extends Enum<E>>
ACycleDetectingLockFactory.WithExplicitOrdering
provides the additional enforcement of an application-specified ordering of lock acquisitions.class
ExecutionSequencer
Serializes execution of tasks, somewhat like an "asynchronoussynchronized
block." Each enqueued callable will not be submitted to its associated executor until the previous callable has returned -- and, if the previous callable was anAsyncCallable
, not until theFuture
it returned is done (successful, failed, or cancelled).class
FakeTimeLimiter
A TimeLimiter implementation which actually does not attempt to limit time at all.class
FluentFuture<V>
AListenableFuture
that supports fluent chains of operations.static class
Futures.FutureCombiner<V>
A helper to create a newListenableFuture
whose result is generated from a combination of input futures.class
JdkFutureAdapters
Utilities necessary for working with libraries that supply plainFuture
instances.interface
ListenableScheduledFuture<V>
Helper interface to implement bothListenableFuture
andScheduledFuture
.class
Monitor
A synchronization abstraction supporting waiting on arbitrary boolean conditions.static class
Monitor.Guard
A boolean condition for which a thread may wait.class
RateLimiter
A rate limiter.class
Runnables
Static utility methods pertaining to theRunnable
interface.class
SimpleTimeLimiter
A TimeLimiter that runs method calls in the background using anExecutorService
.class
Striped<L>
A stripedLock/Semaphore/ReadWriteLock
.interface
TimeLimiter
Imposes a time limit on method calls.Methods in com.google.common.util.concurrent with annotations of type Beta Modifier and Type Method Description static void
MoreExecutors. addDelayedShutdownHook(ExecutorService service, long terminationTimeout, TimeUnit timeUnit)
Add a shutdown hook to wait for thread completion in the givenservice
.static void
MoreExecutors. addDelayedShutdownHook(ExecutorService service, Duration terminationTimeout)
Add a shutdown hook to wait for thread completion in the givenservice
.protected void
AbstractFuture. afterDone()
Callback method that is called exactly once after the future is completed.static <V> ListenableFuture<List<V>>
Futures. allAsList(ListenableFuture<? extends V>... futures)
Creates a newListenableFuture
whose value is a list containing the values of all its input futures, if all succeed.static <V> ListenableFuture<List<V>>
Futures. allAsList(Iterable<? extends ListenableFuture<? extends V>> futures)
Creates a newListenableFuture
whose value is a list containing the values of all its input futures, if all succeed.static <T> AsyncCallable<T>
Callables. asAsyncCallable(Callable<T> callable, ListeningExecutorService listeningExecutorService)
Creates anAsyncCallable
from aCallable
.static void
Uninterruptibles. awaitTerminationUninterruptibly(ExecutorService executor)
Invokesexecutor.
awaitTermination(long, TimeUnit)
uninterruptibly with no timeout.static boolean
Uninterruptibles. awaitTerminationUninterruptibly(ExecutorService executor, long timeout, TimeUnit unit)
Invokesexecutor.
awaitTermination(long, TimeUnit)
uninterruptibly.static boolean
Uninterruptibles. awaitTerminationUninterruptibly(ExecutorService executor, Duration timeout)
Invokesexecutor.
awaitTermination(long, TimeUnit)
uninterruptibly.static boolean
Uninterruptibles. awaitUninterruptibly(CountDownLatch latch, Duration timeout)
Invokeslatch.
await(timeout, unit)
uninterruptibly.static boolean
Uninterruptibles. awaitUninterruptibly(Condition condition, Duration timeout)
Invokescondition.
await(timeout, unit)
uninterruptibly.static <V,X extends Throwable>
ListenableFuture<V>Futures. catching(ListenableFuture<? extends V> input, Class<X> exceptionType, Function<? super X,? extends V> fallback, Executor executor)
Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.static <V,X extends Throwable>
ListenableFuture<V>Futures. catchingAsync(ListenableFuture<? extends V> input, Class<X> exceptionType, AsyncFunction<? super X,? extends V> fallback, Executor executor)
Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.protected void
AbstractService. doCancelStart()
This method is called byAbstractService.stopAsync()
when the service is still starting (i.e.static <V,X extends Exception>
VFutures. getChecked(Future<V> future, Class<X> exceptionClass)
Returns the result ofFuture.get()
, converting most exceptions to a new instance of the given checked exception type.static <V,X extends Exception>
VFutures. getChecked(Future<V> future, Class<X> exceptionClass, long timeout, TimeUnit unit)
Returns the result ofFuture.get(long, TimeUnit)
, converting most exceptions to a new instance of the given checked exception type.static <V,X extends Exception>
VFutures. getChecked(Future<V> future, Class<X> exceptionClass, Duration timeout)
Returns the result ofFuture.get(long, TimeUnit)
, converting most exceptions to a new instance of the given checked exception type.static ExecutorService
MoreExecutors. getExitingExecutorService(ThreadPoolExecutor executor)
Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application is complete.static ExecutorService
MoreExecutors. getExitingExecutorService(ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit)
Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application is complete.static ExecutorService
MoreExecutors. getExitingExecutorService(ThreadPoolExecutor executor, Duration terminationTimeout)
Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application is complete.static ScheduledExecutorService
MoreExecutors. getExitingScheduledExecutorService(ScheduledThreadPoolExecutor executor)
Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the application is complete.static ScheduledExecutorService
MoreExecutors. getExitingScheduledExecutorService(ScheduledThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit)
Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the application is complete.static ScheduledExecutorService
MoreExecutors. getExitingScheduledExecutorService(ScheduledThreadPoolExecutor executor, Duration terminationTimeout)
Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the application is complete.static <V> V
Uninterruptibles. getUninterruptibly(Future<V> future, Duration timeout)
Invokesfuture.
get(timeout, unit)
uninterruptibly.static <T> ImmutableList<ListenableFuture<T>>
Futures. inCompletionOrder(Iterable<? extends ListenableFuture<? extends T>> futures)
Returns a list of delegate futures that correspond to the futures received in the order that they complete.static void
Uninterruptibles. joinUninterruptibly(Thread toJoin, Duration timeout)
Invokesunit.
timedJoin(toJoin, timeout)
uninterruptibly.static <I,O>
Future<O>Futures. lazyTransform(Future<I> input, Function<? super I,? extends O> function)
LikeFutures.transform(ListenableFuture, Function, Executor)
except that the transformationfunction
is invoked on each call toget()
on the returned future.static Executor
MoreExecutors. newSequentialExecutor(Executor delegate)
Returns anExecutor
that runs each task executed sequentially, such that no two tasks are running concurrently.static <V> ListenableFuture<V>
Futures. nonCancellationPropagating(ListenableFuture<V> future)
Returns aListenableFuture
whose result is set from the supplied future when it completes.static ThreadFactory
MoreExecutors. platformThreadFactory()
Returns a default thread factory used to create new threads.boolean
AtomicLongMap. removeIfZero(K key)
Atomically removekey
from the map iff its associated value is 0.static <O> ListenableFuture<O>
Futures. scheduleAsync(AsyncCallable<O> callable, long delay, TimeUnit timeUnit, ScheduledExecutorService executorService)
Schedulescallable
on the specifiedexecutor
, returning aFuture
.static <O> ListenableFuture<O>
Futures. scheduleAsync(AsyncCallable<O> callable, Duration delay, ScheduledExecutorService executorService)
Schedulescallable
on the specifiedexecutor
, returning aFuture
.static boolean
MoreExecutors. shutdownAndAwaitTermination(ExecutorService service, long timeout, TimeUnit unit)
Shuts down the given executor service gradually, first disabling new submissions and later, if necessary, cancelling remaining tasks.static boolean
MoreExecutors. shutdownAndAwaitTermination(ExecutorService service, Duration timeout)
Shuts down the given executor service gradually, first disabling new submissions and later, if necessary, cancelling remaining tasks.static void
Uninterruptibles. sleepUninterruptibly(Duration sleepFor)
Invokesunit.
sleep(sleepFor)
uninterruptibly.static ListenableFuture<Void>
Futures. submit(Runnable runnable, Executor executor)
Executesrunnable
on the specifiedexecutor
, returning aFuture
that will complete after execution.static <O> ListenableFuture<O>
Futures. submit(Callable<O> callable, Executor executor)
Executescallable
on the specifiedexecutor
, returning aFuture
.static <O> ListenableFuture<O>
Futures. submitAsync(AsyncCallable<O> callable, Executor executor)
Executescallable
on the specifiedexecutor
, returning aFuture
.static <V> ListenableFuture<List<V>>
Futures. successfulAsList(ListenableFuture<? extends V>... futures)
Creates a newListenableFuture
whose value is a list containing the values of all its successful input futures.static <V> ListenableFuture<List<V>>
Futures. successfulAsList(Iterable<? extends ListenableFuture<? extends V>> futures)
Creates a newListenableFuture
whose value is a list containing the values of all its successful input futures.static <I,O>
ListenableFuture<O>Futures. transform(ListenableFuture<I> input, Function<? super I,? extends O> function, Executor executor)
Returns a newFuture
whose result is derived from the result of the givenFuture
.static <I,O>
ListenableFuture<O>Futures. transformAsync(ListenableFuture<I> input, AsyncFunction<? super I,? extends O> function, Executor executor)
Returns a newFuture
whose result is asynchronously derived from the result of the givenFuture
.protected void
AbstractExecutionThreadService. triggerShutdown()
Invoked to request the service to stop.static boolean
Uninterruptibles. tryAcquireUninterruptibly(Semaphore semaphore, int permits, Duration timeout)
Invokessemaphore.
tryAcquire(permits, timeout, unit)
uninterruptibly.static boolean
Uninterruptibles. tryAcquireUninterruptibly(Semaphore semaphore, Duration timeout)
Invokessemaphore.
tryAcquire(1, timeout, unit)
uninterruptibly.static boolean
Uninterruptibles. tryLockUninterruptibly(Lock lock, Duration timeout)
Invokeslock.
tryLock(timeout, unit)
uninterruptibly.static <V> Futures.FutureCombiner<V>
Futures. whenAllComplete(ListenableFuture<? extends V>... futures)
Creates aFutures.FutureCombiner
that processes the completed futures whether or not they're successful.static <V> Futures.FutureCombiner<V>
Futures. whenAllComplete(Iterable<? extends ListenableFuture<? extends V>> futures)
Creates aFutures.FutureCombiner
that processes the completed futures whether or not they're successful.static <V> Futures.FutureCombiner<V>
Futures. whenAllSucceed(ListenableFuture<? extends V>... futures)
Creates aFutures.FutureCombiner
requiring that all passed in futures are successful.static <V> Futures.FutureCombiner<V>
Futures. whenAllSucceed(Iterable<? extends ListenableFuture<? extends V>> futures)
Creates aFutures.FutureCombiner
requiring that all passed in futures are successful.static <V> ListenableFuture<V>
Futures. withTimeout(ListenableFuture<V> delegate, long time, TimeUnit unit, ScheduledExecutorService scheduledExecutor)
Returns a future that delegates to another but will finish early (via aTimeoutException
wrapped in anExecutionException
) if the specified duration expires.static <V> ListenableFuture<V>
Futures. withTimeout(ListenableFuture<V> delegate, Duration time, ScheduledExecutorService scheduledExecutor)
Returns a future that delegates to another but will finish early (via aTimeoutException
wrapped in anExecutionException
) if the specified duration expires. -
Uses of Beta in com.google.common.xml
Classes in com.google.common.xml with annotations of type Beta Modifier and Type Class Description class
XmlEscapers
Escaper
instances suitable for strings to be included in XML attribute values and elements' text contents.
-