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.html |
Escapers
for
HTML.
|
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 and
BigInteger 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 and
void , 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.
|
Modifier and Type | Class and Description |
---|---|
static class |
Splitter.MapSplitter
An object that splits strings into maps as
Splitter splits iterables and lists. |
class |
Ticker
A time source; returns a time value representing the number of nanoseconds elapsed since some
fixed but arbitrary point in time.
|
class |
Utf8
Low-level, high-performance utility methods related to the UTF-8
character encoding.
|
Modifier and Type | Field and Description |
---|---|
static CharMatcher |
CharMatcher.ANY
Deprecated.
Use
CharMatcher.any() instead. This constant is scheduled to be
removed in June 2018. |
static CharMatcher |
CharMatcher.ASCII
Deprecated.
Use
CharMatcher.ascii() instead. This constant is scheduled to be
removed in June 2018. |
static CharMatcher |
CharMatcher.BREAKING_WHITESPACE
Deprecated.
Use
CharMatcher.breakingWhitespace() instead. This constant is scheduled
to be removed in June 2018. |
static CharMatcher |
CharMatcher.DIGIT
Deprecated.
Many digits are supplementary characters; see the class
documentation. If you need to use this, use
CharMatcher.digit() instead. This
. constant is scheduled to be removed in June 2018. |
static CharMatcher |
CharMatcher.INVISIBLE
Deprecated.
Most invisible characters are supplementary characters; see the class
documentation. If you need to use this, use
CharMatcher.invisible() instead.
This constant is scheduled to be removed in June 2018. |
static CharMatcher |
CharMatcher.JAVA_DIGIT
Deprecated.
Many digits are supplementary characters; see the class
documentation. If you need to use this, use
CharMatcher.javaDigit() instead.
This constant is scheduled to be removed in June 2018. |
static CharMatcher |
CharMatcher.JAVA_ISO_CONTROL
Deprecated.
Use
CharMatcher.javaIsoControl() instead. This constant is scheduled to
be removed in June 2018. |
static CharMatcher |
CharMatcher.JAVA_LETTER
Deprecated.
Most letters are supplementary characters; see the class
documentation. If you need to use this, use
CharMatcher.javaLetter() instead.
This constant is scheduled to be removed in June 2018. |
static CharMatcher |
CharMatcher.JAVA_LETTER_OR_DIGIT
Deprecated.
Most letters and digits are supplementary characters; see the class
documentation. If you need to use this, use
CharMatcher.javaLetterOrDigit()
instead. This constant is scheduled to be removed in June 2018. |
static CharMatcher |
CharMatcher.JAVA_LOWER_CASE
Deprecated.
Some lowercase letters are supplementary characters; see the class
documentation. If you need to use this, use
CharMatcher.javaLowerCase() instead.
This constant is scheduled to be removed in June 2018. |
static CharMatcher |
CharMatcher.JAVA_UPPER_CASE
Deprecated.
Some uppercase letters are supplementary characters; see the class
documentation. If you need to use this, use
CharMatcher.javaUpperCase() instead.
This constant is scheduled to be removed in June 2018. |
static CharMatcher |
CharMatcher.NONE
Deprecated.
Use
CharMatcher.none() instead. This constant is scheduled to be
removed in June 2018. |
static CharMatcher |
CharMatcher.SINGLE_WIDTH
Deprecated.
Many such characters are supplementary characters; see the class
documentation. If you need to use this, use
CharMatcher.singleWidth() instead.
This constant is scheduled to be removed in June 2018. |
static CharMatcher |
CharMatcher.WHITESPACE
Deprecated.
Use
CharMatcher.whitespace() instead. This constant is scheduled to be
removed in June 2018. |
Modifier and Type | Method and Description |
---|---|
<A extends Appendable> |
Joiner.MapJoiner.appendTo(A appendable,
Iterable<? extends Map.Entry<?,?>> entries)
Appends the string representation of each entry in
entries , using the previously
configured separator and key-value separator, to appendable . |
<A extends Appendable> |
Joiner.MapJoiner.appendTo(A appendable,
Iterator<? extends Map.Entry<?,?>> parts)
Appends the string representation of each entry in
entries , using the previously
configured separator and key-value separator, to appendable . |
StringBuilder |
Joiner.MapJoiner.appendTo(StringBuilder builder,
Iterable<? extends Map.Entry<?,?>> entries)
Appends the string representation of each entry in
entries , using the previously
configured separator and key-value separator, to builder . |
StringBuilder |
Joiner.MapJoiner.appendTo(StringBuilder builder,
Iterator<? extends Map.Entry<?,?>> entries)
Appends the string representation of each entry in
entries , using the previously
configured separator and key-value separator, to builder . |
static List<Throwable> |
Throwables.getCausalChain(Throwable throwable)
Gets a
Throwable cause chain as a list. |
static <X extends Throwable> |
Throwables.getCauseAs(Throwable throwable,
Class<X> expectedCauseType)
Returns
throwable 's cause, cast to expectedCauseType . |
String |
Joiner.MapJoiner.join(Iterable<? extends Map.Entry<?,?>> entries)
Returns a string containing the string representation of each entry in
entries , 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 in
entries , using
the previously configured separator and key-value separator. |
static List<StackTraceElement> |
Throwables.lazyStackTrace(Throwable throwable)
Returns the stack trace of
throwable , possibly providing slower iteration over the full
trace but faster iteration over parts of the trace. |
static boolean |
Throwables.lazyStackTraceIsLazy()
Returns whether
Throwables.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 supplied
optionals , in order,
skipping over occurrences of Optional.absent() . |
List<String> |
Splitter.splitToList(CharSequence sequence)
Splits
sequence into string components and returns them as an immutable list. |
static Predicate<Class<?>> |
Predicates.subtypeOf(Class<?> clazz)
Returns a predicate that evaluates to
true if the class being tested is assignable to
(is a subtype of) clazz . |
Splitter.MapSplitter |
Splitter.withKeyValueSeparator(char separator)
Returns a
MapSplitter 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 a
MapSplitter 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 a
MapSplitter which splits entries based on this splitter, and splits entries
into keys and values using the specified separator. |
Modifier and Type | Class and Description |
---|---|
class |
ArrayTable<R,C,V>
Fixed-size
Table implementation backed by a two-dimensional array. |
class |
Comparators
Provides static methods for working with
Comparator instances. |
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 of
Map.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) , and ForwardingMap.size() . |
protected class |
ForwardingMap.StandardKeySet
A sensible implementation of
Map.keySet() in terms of the following methods: ForwardingMap.clear() , ForwardingMap.containsKey(java.lang.Object) , ForwardingMap.isEmpty() , ForwardingMap.remove(java.lang.Object) , ForwardingMap.size() , and the Set.iterator() method of
ForwardingMap.entrySet() . |
protected class |
ForwardingMap.StandardValues
A sensible implementation of
Map.values() in terms of the following methods: ForwardingMap.clear() , ForwardingMap.containsValue(java.lang.Object) , ForwardingMap.isEmpty() ,
ForwardingMap.size() , and the Set.iterator() method of ForwardingMap.entrySet() . |
protected class |
ForwardingMultiset.StandardElementSet
A sensible implementation of
Multiset.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() , the Set.size() and Set.iterator() methods of ForwardingMultiset.entrySet() , and ForwardingMultiset.remove(Object, int) . |
protected class |
ForwardingNavigableMap.StandardDescendingMap
A sensible implementation of
NavigableMap.descendingMap() in terms of the methods of this
NavigableMap . |
protected class |
ForwardingNavigableMap.StandardNavigableKeySet
A sensible implementation of
NavigableMap.navigableKeySet() in terms of the methods of
this NavigableMap . |
protected class |
ForwardingNavigableSet.StandardDescendingSet
A sensible implementation of
NavigableSet.descendingSet() in terms of the other methods
of NavigableSet , notably including NavigableSet.descendingIterator() . |
protected class |
ForwardingSortedMap.StandardKeySet
A sensible implementation of
SortedMap.keySet() in terms of the methods of ForwardingSortedMap . |
class |
ForwardingSortedMultiset<E>
A sorted multiset which forwards all its method calls to another sorted multiset.
|
class |
ImmutableRangeMap<K extends Comparable<?>,V>
A
RangeMap whose contents will never change, with many other important properties
detailed at ImmutableCollection . |
class |
ImmutableRangeSet<C extends Comparable>
A
RangeSet whose contents will never change, with many other important properties
detailed at ImmutableCollection . |
interface |
Interner<E>
Provides equivalent behavior to
String.intern() for other immutable types. |
class |
Interners
Contains static methods pertaining to instances of
Interner . |
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.
|
class |
MoreCollectors
Collectors not present in
java.util.stream.Collectors that are not otherwise associated
with a com.google.common type. |
class |
MultimapBuilder<K0,V0>
A builder for a multimap implementation that allows customization of the backing map and value
collection implementations used in a particular multimap.
|
interface |
RangeMap<K extends Comparable,V>
A mapping from disjoint nonempty ranges to non-null values.
|
interface |
RangeSet<C extends Comparable>
|
class |
Streams
Static utility methods related to
Stream instances. |
static interface |
Streams.DoubleFunctionWithIndex<R>
An analogue of
DoubleFunction also accepting an index. |
static interface |
Streams.FunctionWithIndex<T,R>
An analogue of
Function also accepting an index. |
static interface |
Streams.IntFunctionWithIndex<R>
An analogue of
IntFunction also accepting an index. |
static interface |
Streams.LongFunctionWithIndex<R>
An analogue of
LongFunction also accepting an index. |
class |
TreeRangeMap<K extends Comparable,V>
An implementation of
RangeMap based on a TreeMap , supporting all optional
operations. |
class |
TreeRangeSet<C extends Comparable<?>>
|
class |
TreeTraverser<T>
Deprecated.
Use
Traverser instead. All instance methods have
their equivalent on the result of Traverser.forTree(tree) where tree
implements SuccessorsFunction , which has a similar API as TreeTraverser.children(T) or can be
the same lambda function as passed into TreeTraverser.using(Function) .
This class is scheduled to be removed in July 2018. |
Modifier and Type | Method and Description |
---|---|
FluentIterable<E> |
FluentIterable.append(E... elements)
Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable,
followed by
elements . |
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 of
other . |
static <A,B> Converter<A,B> |
Maps.asConverter(BiMap<A,B> bimap)
Returns a
Converter that converts values using bimap.get() , and whose
inverse view converts values using bimap.inverse() .get() . |
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)
Returns
multimap.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)
Returns
multimap.asMap() , with its type corrected from Map<K, Collection<V>> to Map<K, SortedSet<V>> . |
static <E> ImmutableList.Builder<E> |
ImmutableList.builderWithExpectedSize(int expectedSize)
Returns a new builder, expecting the specified number of elements 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 <K,V> ImmutableBiMap.Builder<K,V> |
ImmutableBiMap.builderWithExpectedSize(int expectedSize)
Returns a new builder, expecting the specified number of entries 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 List<Character> |
Lists.charactersOf(CharSequence sequence)
Returns a view of the specified
CharSequence as a List<Character> , viewing
sequence as a sequence of Unicode code units. |
static ContiguousSet<Integer> |
ContiguousSet.closed(int lower,
int upper)
Returns a nonempty contiguous set containing all
int values from lower
(inclusive) to upper (inclusive). |
static ContiguousSet<Long> |
ContiguousSet.closed(long lower,
long upper)
Returns a nonempty contiguous set containing all
long values from lower
(inclusive) to upper (inclusive). |
static ContiguousSet<Integer> |
ContiguousSet.closedOpen(int lower,
int upper)
Returns a contiguous set containing all
int values from lower (inclusive) to
upper (exclusive). |
static ContiguousSet<Long> |
ContiguousSet.closedOpen(long lower,
long upper)
Returns a contiguous set containing all
long values from lower (inclusive) to
upper (exclusive). |
static <E> Set<Set<E>> |
Sets.combinations(Set<E> set,
int size)
Returns the set of all subsets of
set of size size . |
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 of
multiset as an ImmutableMultiset whose iteration order is
highest count first, with ties broken by the iteration order of the original multiset. |
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> 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> 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> 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> 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> 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, empty
ConcurrentHashMultiset using countMap 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 as
BlockingQueue.drainTo(Collection, int) , but if the requested numElements 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 <T> Comparator<Optional<T>> |
Comparators.emptiesFirst(Comparator<? super T> valueComparator)
Returns a comparator of
Optional values which treats Optional.empty() as less
than all other values, and orders the rest using valueComparator on the contained
value. |
static <T> Comparator<Optional<T>> |
Comparators.emptiesLast(Comparator<? super T> valueComparator)
Returns a comparator of
Optional values which treats Optional.empty() as greater
than all other values, and orders the rest using valueComparator on the contained
value. |
static <E> Multiset<E> |
Multisets.filter(Multiset<E> unfiltered,
Predicate<? super E> predicate)
Returns a view of the elements of
unfiltered that satisfy a predicate. |
static <T,K,V> Collector<T,?,ImmutableListMultimap<K,V>> |
ImmutableListMultimap.flatteningToImmutableListMultimap(Function<? super T,? extends K> keyFunction,
Function<? super T,? extends Stream<? extends V>> valuesFunction)
Returns a
Collector accumulating entries into an ImmutableListMultimap . |
static <T,K,V> Collector<T,?,ImmutableSetMultimap<K,V>> |
ImmutableSetMultimap.flatteningToImmutableSetMultimap(Function<? super T,? extends K> keyFunction,
Function<? super T,? extends Stream<? extends V>> valuesFunction)
Returns a
Collector accumulating entries into an ImmutableSetMultimap . |
static <T,K,V,M extends Multimap<K,V>> |
Multimaps.flatteningToMultimap(Function<? super T,? extends K> keyFunction,
Function<? super T,? extends Stream<? extends V>> valueFunction,
Supplier<M> multimapSupplier)
Returns a
Collector accumulating entries into a Multimap 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 <E> FluentIterable<E> |
FluentIterable.from(E[] elements)
Returns a fluent iterable containing
elements in the specified order. |
static <K extends Enum<K>,V> |
Maps.immutableEnumMap(Map<K,? extends V> map)
Returns an immutable map instance containing the given entries.
|
String |
FluentIterable.join(Joiner joiner)
Returns a
String containing all of the elements of this fluent iterable joined with
joiner . |
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 given
iterables . |
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 given
iterators , traversing every
element of the input iterators. |
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(E element,
E... elements)
Returns a fluent iterable containing the specified elements in order.
|
static <E extends Comparable<? super E>> |
Collections2.orderedPermutations(Iterable<E> elements)
Returns a
Collection of all the permutations of the specified Iterable . |
static <E> Collection<List<E>> |
Collections2.orderedPermutations(Iterable<E> elements,
Comparator<? super E> comparator)
Returns a
Collection of all the permutations of the specified Iterable using
the specified Comparator for establishing the lexicographical ordering. |
ImmutableBiMap.Builder<K,V> |
ImmutableBiMap.Builder.orderEntriesByValue(Comparator<? super V> valueComparator)
Configures this
Builder to order entries by value according to the specified
comparator. |
ImmutableMap.Builder<K,V> |
ImmutableMap.Builder.orderEntriesByValue(Comparator<? super V> valueComparator)
Configures this
Builder 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 a
Collection of all the permutations of the specified Collection . |
ImmutableSetMultimap.Builder<K,V> |
ImmutableSetMultimap.Builder.putAll(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Adds entries to the built multimap.
|
ImmutableMultimap.Builder<K,V> |
ImmutableMultimap.Builder.putAll(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Adds entries to the built multimap.
|
ImmutableListMultimap.Builder<K,V> |
ImmutableListMultimap.Builder.putAll(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
Adds entries to the built multimap.
|
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.
|
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.
|
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 of
ForwardingCollection.addAll(Collection) in terms of ForwardingCollection.add(Object) and
ForwardingMultiset.add(Object, int) . |
protected boolean |
ForwardingSortedSet.standardContains(Object object)
A sensible definition of
ForwardingCollection.contains(java.lang.Object) in terms of the first() method of ForwardingSortedSet.tailSet(E) . |
protected boolean |
ForwardingSortedMap.standardContainsKey(Object key)
A sensible definition of
ForwardingMap.containsKey(java.lang.Object) in terms of the firstKey() method of
ForwardingSortedMap.tailMap(K) . |
protected boolean |
ForwardingMap.standardContainsKey(Object key)
A sensible, albeit inefficient, definition of
ForwardingMap.containsKey(java.lang.Object) in terms of the iterator method of ForwardingMap.entrySet() . |
protected int |
ForwardingMultiset.standardCount(Object object)
A sensible, albeit inefficient, definition of
ForwardingMultiset.count(java.lang.Object) in terms of ForwardingMultiset.entrySet() . |
protected NavigableSet<K> |
ForwardingNavigableMap.standardDescendingKeySet()
A sensible definition of
ForwardingNavigableMap.descendingKeySet() as the navigableKeySet of ForwardingNavigableMap.descendingMap() . |
protected boolean |
ForwardingList.standardEquals(Object object)
A sensible definition of
ForwardingList.equals(Object) in terms of ForwardingCollection.size() and ForwardingCollection.iterator() . |
protected int |
ForwardingList.standardHashCode()
A sensible definition of
ForwardingList.hashCode() in terms of ForwardingCollection.iterator() . |
protected ListIterator<E> |
ForwardingList.standardListIterator(int start)
A sensible default implementation of
ForwardingList.listIterator(int) , in terms of ForwardingCollection.size() ,
ForwardingList.get(int) , ForwardingList.set(int, Object) , ForwardingList.add(int, Object) , and ForwardingList.remove(int) . |
protected boolean |
ForwardingSortedSet.standardRemove(Object object)
A sensible definition of
ForwardingCollection.remove(java.lang.Object) in terms of the iterator() method of ForwardingSortedSet.tailSet(E) . |
protected V |
ForwardingMap.standardRemove(Object key)
A sensible, albeit inefficient, definition of
ForwardingMap.remove(java.lang.Object) in terms of the iterator
method of ForwardingMap.entrySet() . |
protected List<E> |
ForwardingList.standardSubList(int fromIndex,
int toIndex)
A sensible default implementation of
ForwardingList.subList(int, int) . |
protected SortedMap<K,V> |
ForwardingSortedMap.standardSubMap(K fromKey,
K toKey)
A sensible default implementation of
ForwardingSortedMap.subMap(Object, Object) in terms of ForwardingSortedMap.headMap(Object) and ForwardingSortedMap.tailMap(Object) . |
protected NavigableSet<E> |
ForwardingNavigableSet.standardSubSet(E fromElement,
boolean fromInclusive,
E toElement,
boolean toInclusive)
A sensible definition of
ForwardingNavigableSet.subSet(Object, boolean, Object, boolean) in terms of the
headSet and tailSet methods. |
protected SortedSet<E> |
ForwardingSortedSet.standardSubSet(E fromElement,
E toElement)
A sensible default implementation of
ForwardingSortedSet.subSet(Object, Object) in terms of ForwardingSortedSet.headSet(Object) and ForwardingSortedSet.tailSet(Object) . |
protected String |
ForwardingMapEntry.standardToString()
A sensible definition of
ForwardingObject.toString() in terms of ForwardingMapEntry.getKey() and ForwardingMapEntry.getValue() . |
static <K extends Comparable<? super K>,V> |
Maps.subMap(NavigableMap<K,V> map,
Range<K> range)
Returns a view of the portion of
map whose keys are contained by range . |
static <K extends Comparable<? super K>> |
Sets.subSet(NavigableSet<K> set,
Range<K> range)
Returns a view of the portion of
set whose elements are contained by range . |
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,K,V> Collector<T,?,ImmutableBiMap<K,V>> |
ImmutableBiMap.toImmutableBiMap(Function<? super T,? extends K> keyFunction,
Function<? super T,? extends V> valueFunction)
Returns a
Collector that accumulates elements into an ImmutableBiMap whose keys
and values are the result of applying the provided mapping functions to the input elements. |
static <T,K extends Enum<K>,V> |
Maps.toImmutableEnumMap(Function<? super T,? extends K> keyFunction,
Function<? super T,? extends V> valueFunction)
Returns a
Collector that accumulates elements into an ImmutableMap whose keys
and values are the result of applying the provided mapping functions to the input elements. |
static <T,K extends Enum<K>,V> |
Maps.toImmutableEnumMap(Function<? super T,? extends K> keyFunction,
Function<? super T,? extends V> valueFunction,
BinaryOperator<V> mergeFunction)
Returns a
Collector that accumulates elements into an ImmutableMap whose keys
and values are the result of applying the provided mapping functions to the input elements. |
static <E extends Enum<E>> |
Sets.toImmutableEnumSet()
Returns a
Collector that accumulates the input elements into a new ImmutableSet
with an implementation specialized for enums. |
static <E> Collector<E,?,ImmutableList<E>> |
ImmutableList.toImmutableList()
Returns a
Collector that accumulates the input elements into a new ImmutableList , in encounter order. |
static <T,K,V> Collector<T,?,ImmutableListMultimap<K,V>> |
ImmutableListMultimap.toImmutableListMultimap(Function<? super T,? extends K> keyFunction,
Function<? super T,? extends V> valueFunction)
Returns a
Collector that accumulates elements into an ImmutableListMultimap
whose keys and values are the result of applying the provided mapping functions to the input
elements. |
static <T,K,V> Collector<T,?,ImmutableMap<K,V>> |
ImmutableMap.toImmutableMap(Function<? super T,? extends K> keyFunction,
Function<? super T,? extends V> valueFunction)
Returns a
Collector that accumulates elements into an ImmutableMap whose keys
and values are the result of applying the provided mapping functions to the input elements. |
static <T,K,V> Collector<T,?,ImmutableMap<K,V>> |
ImmutableMap.toImmutableMap(Function<? super T,? extends K> keyFunction,
Function<? super T,? extends V> valueFunction,
BinaryOperator<V> mergeFunction)
Returns a
Collector that accumulates elements into an ImmutableMap whose keys
and values are the result of applying the provided mapping functions to the input elements. |
static <E> Collector<E,?,ImmutableMultiset<E>> |
ImmutableMultiset.toImmutableMultiset()
Returns a
Collector that accumulates the input elements into a new ImmutableMultiset . |
static <T,K extends Comparable<? super K>,V> |
ImmutableRangeMap.toImmutableRangeMap(Function<? super T,Range<K>> keyFunction,
Function<? super T,? extends V> valueFunction)
Returns a
Collector that accumulates the input elements into a new ImmutableRangeMap . |
static <E extends Comparable<? super E>> |
ImmutableRangeSet.toImmutableRangeSet()
Returns a
Collector that accumulates the input elements into a new ImmutableRangeSet . |
static <E> Collector<E,?,ImmutableSet<E>> |
ImmutableSet.toImmutableSet()
Returns a
Collector that accumulates the input elements into a new ImmutableSet . |
static <T,K,V> Collector<T,?,ImmutableSetMultimap<K,V>> |
ImmutableSetMultimap.toImmutableSetMultimap(Function<? super T,? extends K> keyFunction,
Function<? super T,? extends V> valueFunction)
Returns a
Collector that accumulates elements into an ImmutableSetMultimap
whose keys and values are the result of applying the provided mapping functions to the input
elements. |
static <T,K,V> Collector<T,?,ImmutableSortedMap<K,V>> |
ImmutableSortedMap.toImmutableSortedMap(Comparator<? super K> comparator,
Function<? super T,? extends K> keyFunction,
Function<? super T,? extends V> valueFunction)
Returns a
Collector that accumulates elements into an ImmutableSortedMap whose
keys and values are the result of applying the provided mapping functions to the input
elements. |
static <T,K,V> Collector<T,?,ImmutableSortedMap<K,V>> |
ImmutableSortedMap.toImmutableSortedMap(Comparator<? super K> comparator,
Function<? super T,? extends K> keyFunction,
Function<? super T,? extends V> valueFunction,
BinaryOperator<V> mergeFunction)
Returns a
Collector that accumulates elements into an ImmutableSortedMap whose
keys and values are the result of applying the provided mapping functions to the input
elements. |
static <E> Collector<E,?,ImmutableSortedMultiset<E>> |
ImmutableSortedMultiset.toImmutableSortedMultiset(Comparator<? super E> comparator)
Returns a
Collector that accumulates the input elements into a new ImmutableMultiset . |
static <E> Collector<E,?,ImmutableSortedSet<E>> |
ImmutableSortedSet.toImmutableSortedSet(Comparator<? super E> comparator)
Returns a
Collector that accumulates the input elements into a new ImmutableSortedSet , ordered by the specified comparator. |
static <T,R,C,V> Collector<T,?,ImmutableTable<R,C,V>> |
ImmutableTable.toImmutableTable(Function<? super T,? extends R> rowFunction,
Function<? super T,? extends C> columnFunction,
Function<? super T,? extends V> valueFunction)
Returns a
Collector that accumulates elements into an ImmutableTable . |
static <T,K,V,M extends Multimap<K,V>> |
Multimaps.toMultimap(Function<? super T,? extends K> keyFunction,
Function<? super T,? extends V> valueFunction,
Supplier<M> multimapSupplier)
Returns a
Collector accumulating entries into a Multimap generated from the
specified supplier. |
static <T,R,C,V,I extends Table<R,C,V>> |
Tables.toTable(Function<? super T,? extends R> rowFunction,
Function<? super T,? extends C> columnFunction,
Function<? super T,? extends V> valueFunction,
Supplier<I> tableSupplier)
Returns a
Collector that accumulates elements into a Table created using the
specified supplier, whose cells are generated by applying the provided mapping functions to the
input elements. |
static <R,C,V1,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.
|
Modifier and Type | Class and Description |
---|---|
class |
ArrayBasedCharEscaper
A
CharEscaper that uses an array to quickly look up replacement characters for a given
char value. |
class |
ArrayBasedEscaperMap
An implementation-specific parameter class suitable for initializing
ArrayBasedCharEscaper or ArrayBasedUnicodeEscaper instances. |
class |
ArrayBasedUnicodeEscaper
A
UnicodeEscaper 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 to
Escaper instances. |
static class |
Escapers.Builder
A builder for simple, fast escapers.
|
class |
UnicodeEscaper
An
Escaper that converts literal text into a format safe for inclusion in a particular
context (such as an XML document). |
Modifier and Type | Class and Description |
---|---|
interface |
AllowConcurrentEvents
Marks an event subscriber method as being thread-safe.
|
class |
AsyncEventBus
An
EventBus 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.
|
Modifier and Type | Class and Description |
---|---|
class |
AbstractGraph<N>
This class provides a skeletal implementation of
Graph . |
class |
AbstractNetwork<N,E>
This class provides a skeletal implementation of
Network . |
class |
AbstractValueGraph<N,V>
This class provides a skeletal implementation of
ValueGraph . |
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 of
MutableGraph with user-defined properties. |
class |
Graphs
|
class |
ImmutableGraph<N>
A
Graph whose elements and structural relationships will never change. |
class |
ImmutableNetwork<N,E>
A
Network whose elements and structural relationships will never change. |
class |
ImmutableValueGraph<N,V>
A
ValueGraph whose elements and structural relationships will never change. |
interface |
MutableGraph<N>
A subinterface of
Graph which adds mutation methods. |
interface |
MutableNetwork<N,E>
A subinterface of
Network which adds mutation methods. |
interface |
MutableValueGraph<N,V>
A subinterface of
ValueGraph 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 of
MutableNetwork 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 specified
SuccessorsFunction . |
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 of
MutableValueGraph with user-defined properties. |
Modifier and Type | Class and Description |
---|---|
class |
BloomFilter<T>
A Bloom filter for instances of
T . |
interface |
Funnel<T>
An object which can send data from an object of type
T into a PrimitiveSink . |
class |
Funnels
Funnels for common types.
|
class |
HashCode
An immutable hash code of arbitrary bit length.
|
interface |
Hasher
A
PrimitiveSink 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 obtain
HashFunction instances, and other static hashing-related
utilities. |
class |
HashingInputStream
An
InputStream that maintains a hash of the data read from it. |
class |
HashingOutputStream
An
OutputStream that maintains a hash of the data written to it. |
interface |
PrimitiveSink
An object which can receive a stream of primitive values.
|
Modifier and Type | Class and Description |
---|---|
class |
HtmlEscapers
Escaper instances suitable for strings to be included in HTML attribute values and
most elements' text contents. |
Modifier and Type | Interface and Description |
---|---|
interface |
ByteProcessor<T>
A callback interface to process bytes from a stream.
|
class |
ByteStreams
Provides utility methods for working with byte arrays and I/O streams.
|
class |
CharStreams
Provides utility methods for working with character streams.
|
class |
Closeables
Utility methods for working with
Closeable objects. |
class |
Closer
|
class |
CountingInputStream
An
InputStream that counts the number of bytes read. |
class |
CountingOutputStream
An OutputStream that counts the number of bytes written.
|
class |
FileBackedOutputStream
An
OutputStream that starts buffering to a byte array, but switches to file buffering
once the data reaches a configurable size. |
class |
Files
Provides utility methods for working with files.
|
class |
Flushables
Utility methods for working with
Flushable 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 streaming
readLines methods. |
class |
LineReader
A class for reading lines of text.
|
class |
LittleEndianDataInputStream
An implementation of
DataInput that uses little-endian byte ordering for reading short , int , float , double , and long values. |
class |
LittleEndianDataOutputStream
An implementation of
DataOutput that uses little-endian byte ordering for writing char , short , int , float , double , and long 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...) and MoreFiles.deleteDirectoryContents(java.nio.file.Path, com.google.common.io.RecursiveDeleteOption...) ). |
class |
Resources
Provides utility methods for working with resources in the classpath.
|
Modifier and Type | Method and Description |
---|---|
ByteSource |
CharSource.asByteSource(Charset charset)
Returns a
ByteSource view of this char source that encodes chars read from this source
as bytes using the given Charset . |
void |
CharSource.forEachLine(Consumer<? super String> action)
Reads all lines of text from this source, running the given
action for each line as it
is read. |
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.
|
Stream<String> |
CharSource.lines()
Opens a new
Stream for reading text one line at a time from this source. |
<T> T |
ByteSource.read(ByteProcessor<T> processor)
Reads the contents of this byte source using the given
processor to process bytes as
they are read. |
<T> T |
CharSource.readLines(LineProcessor<T> processor)
Reads lines of text from this source, processing each line as it is read using the given
processor . |
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.
|
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.
|
Modifier and Type | Class and Description |
---|---|
class |
LinearTransformation
The representation of a linear transformation between real numbers
x and y . |
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.
|
Modifier and Type | Method and Description |
---|---|
static BigInteger |
BigIntegerMath.ceilingPowerOfTwo(BigInteger x)
Returns the smallest power of two greater than or equal to
x . |
static int |
IntMath.ceilingPowerOfTwo(int x)
Returns the smallest power of two greater than or equal to
x . |
static long |
LongMath.ceilingPowerOfTwo(long x)
Returns the smallest power of two greater than or equal to
x . |
static BigInteger |
BigIntegerMath.floorPowerOfTwo(BigInteger x)
Returns the largest power of two less than or equal to
x . |
static int |
IntMath.floorPowerOfTwo(int x)
Returns the largest power of two less than or equal to
x . |
static long |
LongMath.floorPowerOfTwo(long x)
Returns the largest power of two less than or equal to
x . |
static boolean |
IntMath.isPrime(int n)
Returns
true if n 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)
Returns
true if n 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 of
a and b unless it would overflow or underflow in which case
Integer.MAX_VALUE or Integer.MIN_VALUE is returned, respectively. |
static long |
LongMath.saturatedAdd(long a,
long b)
Returns the sum of
a and b unless it would overflow or underflow in which case
Long.MAX_VALUE or Long.MIN_VALUE is returned, respectively. |
static int |
IntMath.saturatedMultiply(int a,
int b)
Returns the product of
a and b unless it would overflow or underflow in which
case Integer.MAX_VALUE or Integer.MIN_VALUE is returned, respectively. |
static long |
LongMath.saturatedMultiply(long a,
long b)
Returns the product of
a and b unless it would overflow or underflow in which
case Long.MAX_VALUE or Long.MIN_VALUE is returned, respectively. |
static int |
IntMath.saturatedPow(int b,
int k)
Returns the
b to the k th power, unless it would overflow or underflow in which
case Integer.MAX_VALUE or Integer.MIN_VALUE is returned, respectively. |
static long |
LongMath.saturatedPow(long b,
int k)
Returns the
b to the k th power, unless it would overflow or underflow in which
case Long.MAX_VALUE or Long.MIN_VALUE is returned, respectively. |
static int |
IntMath.saturatedSubtract(int a,
int b)
Returns the difference of
a and b unless it would overflow or underflow in
which case Integer.MAX_VALUE or Integer.MIN_VALUE is returned, respectively. |
static long |
LongMath.saturatedSubtract(long a,
long b)
Returns the difference of
a and b unless it would overflow or underflow in
which case Long.MAX_VALUE or Long.MIN_VALUE is returned, respectively. |
Modifier and Type | Class and 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 to
InetAddress 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 as
com or foo.co.uk . |
class |
MediaType
Represents an Internet Media Type
(also known as a MIME Type or Content Type).
|
class |
PercentEscaper
A
UnicodeEscaper that escapes some set of Java characters using a UTF-8 based percent
encoding scheme. |
Modifier and Type | Field and Description |
---|---|
static String |
HttpHeaders.FOLLOW_ONLY_WHEN_PRERENDER_SHOWN
The HTTP
Follow-Only-When-Prerender-Shown header field name. |
static String |
HttpHeaders.PUBLIC_KEY_PINS
The HTTP
Public-Key-Pins header field name. |
static String |
HttpHeaders.PUBLIC_KEY_PINS_REPORT_ONLY
The HTTP
Public-Key-Pins-Report-Only header field name. |
static String |
HttpHeaders.X_DOWNLOAD_OPTIONS
The HTTP
X-Download-Options header field name. |
Modifier and Type | Class and Description |
---|---|
class |
ImmutableDoubleArray
An immutable array of
double values, with an API resembling List . |
class |
ImmutableIntArray
An immutable array of
int values, with an API resembling List . |
class |
ImmutableLongArray
An immutable array of
long values, with an API resembling List . |
class |
UnsignedInts
Static utility methods pertaining to
int primitives that interpret values as
unsigned (that is, any negative value x is treated as the positive value 2^32 + x ). |
class |
UnsignedLongs
Static utility methods pertaining to
long primitives that interpret values as
unsigned (that is, any negative value x is treated as the positive value 2^64 + x ). |
Modifier and Type | Method and Description |
---|---|
static char |
Chars.constrainToRange(char value,
char min,
char max)
Returns the value nearest to
value which is within the closed range [min..max] . |
static double |
Doubles.constrainToRange(double value,
double min,
double max)
Returns the value nearest to
value which is within the closed range [min..max] . |
static float |
Floats.constrainToRange(float value,
float min,
float max)
Returns the value nearest to
value which is within the closed range [min..max] . |
static int |
Ints.constrainToRange(int value,
int min,
int max)
Returns the value nearest to
value which is within the closed range [min..max] . |
static long |
Longs.constrainToRange(long value,
long min,
long max)
Returns the value nearest to
value which is within the closed range [min..max] . |
static short |
Shorts.constrainToRange(short value,
short min,
short max)
Returns the value nearest to
value which is within the closed range [min..max] . |
static int |
Booleans.countTrue(boolean... values)
Returns the number of
values that are true . |
static Comparator<Boolean> |
Booleans.falseFirst()
Returns a
Comparator<Boolean> that sorts false before true . |
static byte |
UnsignedBytes.parseUnsignedByte(String string)
Returns the unsigned
byte value represented by the given decimal string. |
static byte |
UnsignedBytes.parseUnsignedByte(String string,
int radix)
Returns the unsigned
byte value represented by a string with the given radix. |
static Converter<String,Integer> |
Ints.stringConverter()
Returns a serializable converter object that converts between strings and integers using
Integer.decode(java.lang.String) and Integer.toString() . |
static Converter<String,Short> |
Shorts.stringConverter()
Returns a serializable converter object that converts between strings and shorts using
Short.decode(java.lang.String) and Short.toString() . |
static Converter<String,Float> |
Floats.stringConverter()
Returns a serializable converter object that converts between strings and floats using
Float.valueOf(java.lang.String) and Float.toString() . |
static Converter<String,Double> |
Doubles.stringConverter()
Returns a serializable converter object that converts between strings and doubles using
Double.valueOf(java.lang.String) and Double.toString() . |
static Converter<String,Long> |
Longs.stringConverter()
Returns a serializable converter object that converts between strings and longs using
Long.decode(java.lang.String) and Long.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 of
x for the given radix, where x is treated as
unsigned. |
static Comparator<Boolean> |
Booleans.trueFirst()
Returns a
Comparator<Boolean> that sorts true before false . |
static Integer |
Ints.tryParse(String string)
Parses the specified string as a signed decimal integer value.
|
static Float |
Floats.tryParse(String string)
Parses the specified string as a single-precision floating point value.
|
static Double |
Doubles.tryParse(String string)
Parses the specified string as a double-precision floating point value.
|
static Long |
Longs.tryParse(String string)
Parses the specified string as a signed decimal long value.
|
static Integer |
Ints.tryParse(String string,
int radix)
Parses the specified string as a signed integer value using the specified radix.
|
static Long |
Longs.tryParse(String string,
int radix)
Parses the specified string as a signed long value using the specified radix.
|
Modifier and Type | Class and Description |
---|---|
class |
AbstractInvocationHandler
Abstract implementation of
InvocationHandler that handles Object.equals(java.lang.Object) , Object.hashCode() and Object.toString() . |
class |
ClassPath
Scans the source of a
ClassLoader and finds all loadable classes and resources. |
static class |
ClassPath.ClassInfo
Represents a class that can be loaded through
ClassPath.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 an
ImmutableMap . |
static class |
ImmutableTypeToInstanceMap.Builder<B>
A builder for creating immutable type-to-instance maps.
|
class |
Invokable<T,R>
Wrapper around either a
Method or a Constructor . |
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 in
TypeToken.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 a
TypeToken to an instance of that type. |
class |
TypeToken<T>
A
Type with generics. |
Modifier and Type | Class and Description |
---|---|
class |
AbstractCheckedFuture<V,X extends Exception>
Deprecated.
CheckedFuture cannot properly support the chained operations that are the
primary goal of ListenableFuture . CheckedFuture also encourages users to
rethrow exceptions from one thread in another thread, producing misleading stack traces.
Additionally, it has a surprising policy about which exceptions to map and which to leave
untouched. Guava users who want a CheckedFuture can fork the classes for their own
use, possibly specializing them to the particular exception type they use. We recommend that
most people use ListenableFuture and perform any exception wrapping themselves. This
class is scheduled for removal from Guava in February 2018. |
class |
AbstractExecutionThreadService
Base class for services that can implement
AbstractExecutionThreadService.startUp() , AbstractExecutionThreadService.run() and AbstractExecutionThreadService.shutDown()
methods. |
class |
AbstractIdleService
Base class for services that do not need a thread while "running" but may need one during startup
and shutdown.
|
class |
AbstractListeningExecutorService
Abstract
ListeningExecutorService implementation that creates ListenableFuture
instances for each Runnable and Callable submitted to it. |
class |
AbstractScheduledService
Base class for services that can implement
AbstractScheduledService.startUp() and AbstractScheduledService.shutDown() but while in
the "running" state need to perform a periodic task. |
static class |
AbstractScheduledService.CustomScheduler
A
AbstractScheduledService.Scheduler that provides a convenient way for the AbstractScheduledService to
use a dynamically changing schedule. |
protected static class |
AbstractScheduledService.CustomScheduler.Schedule
A value object that represents an absolute delay until a task should be invoked.
|
class |
AbstractService
Base class for implementing services that can handle
AbstractService.doStart() and AbstractService.doStop()
requests, responding to them with AbstractService.notifyStarted() and AbstractService.notifyStopped()
callbacks. |
interface |
AsyncCallable<V>
Computes a value, possibly asynchronously.
|
interface |
CheckedFuture<V,X extends Exception>
Deprecated.
CheckedFuture cannot properly support the chained operations that are the
primary goal of ListenableFuture . CheckedFuture also encourages users to
rethrow exceptions from one thread in another thread, producing misleading stack traces.
Additionally, it has a surprising policy about which exceptions to map and which to leave
untouched. Guava users who want a CheckedFuture can fork the classes for their own
use, possibly specializing them to the particular exception type they use. We recommend that
most people use ListenableFuture and perform any exception wrapping themselves. This
class is scheduled for removal from Guava in February 2018. |
class |
CycleDetectingLockFactory
The
CycleDetectingLockFactory creates ReentrantLock instances and ReentrantReadWriteLock instances that detect potential deadlock by checking for cycles in lock
acquisition order. |
static class |
CycleDetectingLockFactory.Policies
Pre-defined
CycleDetectingLockFactory.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>>
A
CycleDetectingLockFactory.WithExplicitOrdering provides the additional enforcement of
an application-specified ordering of lock acquisitions. |
class |
FakeTimeLimiter
A TimeLimiter implementation which actually does not attempt to limit time at all.
|
class |
FluentFuture<V>
A
ListenableFuture that supports fluent chains of operations. |
class |
ForwardingCheckedFuture<V,X extends Exception>
Deprecated.
CheckedFuture cannot properly support the chained operations that are the
primary goal of ListenableFuture . CheckedFuture also encourages users to
rethrow exceptions from one thread in another thread, producing misleading stack traces.
Additionally, it has a surprising policy about which exceptions to map and which to leave
untouched. Guava users who want a CheckedFuture can fork the classes for their own
use, possibly specializing them to the particular exception type they use. We recommend that
most people use ListenableFuture and perform any exception wrapping themselves. This
class is scheduled for removal from Guava in February 2018. |
static class |
ForwardingCheckedFuture.SimpleForwardingCheckedFuture<V,X extends Exception>
Deprecated.
CheckedFuture cannot properly support the chained operations that are the
primary goal of ListenableFuture . CheckedFuture also encourages users to
rethrow exceptions from one thread in another thread, producing misleading stack traces.
Additionally, it has a surprising policy about which exceptions to map and which to leave
untouched. Guava users who want a CheckedFuture can fork the classes for their own
use, possibly specializing them to the particular exception type they use. We recommend
that most people use ListenableFuture and perform any exception wrapping
themselves. This class is scheduled for removal from Guava in February 2018. |
class |
Futures
Static utility methods pertaining to the
Future interface. |
static class |
Futures.FutureCombiner<V>
A helper to create a new
ListenableFuture whose result is generated from a combination
of input futures. |
class |
JdkFutureAdapters
Utilities necessary for working with libraries that supply plain
Future instances. |
interface |
ListenableScheduledFuture<V>
Helper interface to implement both
ListenableFuture and ScheduledFuture . |
interface |
ListeningScheduledExecutorService
A
ScheduledExecutorService that returns ListenableFuture instances from its
ExecutorService methods. |
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 the
Runnable interface. |
interface |
Service
An object with an operational state, plus asynchronous
Service.startAsync() and Service.stopAsync() lifecycle methods to transition between states. |
static class |
Service.Listener
A listener for the various state changes that a
Service goes through in its lifecycle. |
static class |
Service.State
The lifecycle states of a service.
|
class |
ServiceManager
A manager for monitoring and controlling a set of services.
|
static class |
ServiceManager.Listener
A listener for the aggregate state changes of the services that are under management.
|
class |
SimpleTimeLimiter
A TimeLimiter that runs method calls in the background using an
ExecutorService . |
class |
Striped<L>
A striped
Lock/Semaphore/ReadWriteLock . |
interface |
TimeLimiter
Imposes a time limit on method calls.
|
class |
Uninterruptibles
Utilities for treating interruptible operations as uninterruptible.
|
Modifier and Type | Method and Description |
---|---|
static void |
MoreExecutors.addDelayedShutdownHook(ExecutorService service,
long terminationTimeout,
TimeUnit timeUnit)
Add a shutdown hook to wait for thread completion in the given
service . |
protected void |
AbstractFuture.afterDone()
Callback method that is called exactly once after the future is completed.
|
static <V> ListenableFuture<List<V>> |
Futures.allAsList(Iterable<? extends ListenableFuture<? extends V>> futures)
Creates a new
ListenableFuture whose value is a list containing the values of all its
input futures, if all succeed. |
static <V> ListenableFuture<List<V>> |
Futures.allAsList(ListenableFuture<? extends V>... futures)
Creates a new
ListenableFuture 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 an
AsyncCallable from a Callable . |
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 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 <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 Executor |
MoreExecutors.newSequentialExecutor(Executor delegate)
Returns an
Executor that runs each task executed sequentially, such that no two tasks
are running concurrently. |
static ThreadFactory |
MoreExecutors.platformThreadFactory()
Returns a default thread factory used to create new threads.
|
boolean |
AtomicLongMap.removeIfZero(K key)
Atomically remove
key from the map iff its associated value is 0. |
protected boolean |
AbstractFuture.setFuture(ListenableFuture<? extends V> future)
Sets the result of this
Future to match the supplied input Future once the
supplied Future is done, unless this Future has already been cancelled or set
(including "set asynchronously," defined below). |
boolean |
SettableFuture.setFuture(ListenableFuture<? extends V> future) |
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 <V> ListenableFuture<List<V>> |
Futures.successfulAsList(Iterable<? extends ListenableFuture<? extends V>> futures)
Creates a new
ListenableFuture whose value is a list containing the values of all its
successful input futures. |
static <V> ListenableFuture<List<V>> |
Futures.successfulAsList(ListenableFuture<? extends V>... futures)
Creates a new
ListenableFuture whose value is a list containing the values of all its
successful input futures. |
Modifier and Type | Class and Description |
---|---|
class |
XmlEscapers
Escaper instances suitable for strings to be included in XML attribute values and
elements' text contents. |
Copyright © 2010–2018. All rights reserved.