Package | Description |
---|---|
com.google.common.base |
Basic utility libraries and interfaces.
|
com.google.common.cache |
This package contains caching utilities.
|
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.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.
|
Modifier and Type | Interface and Description |
---|---|
private static interface |
Suppliers.SupplierFunction<T> |
Modifier and Type | Class and Description |
---|---|
private static class |
CaseFormat.StringConverter |
class |
Converter<A,B>
A function from
A to B with an associated reverse function from B
to A ; used for converting back and forth between different representations of the same
information. |
private static class |
Converter.ConverterComposition<A,B,C> |
private static class |
Converter.FunctionBasedConverter<A,B> |
private static class |
Converter.IdentityConverter<T>
A converter that always converts or reverses an object to itself.
|
private static class |
Converter.ReverseConverter<A,B> |
private static class |
Enums.StringConverter<T extends java.lang.Enum<T>> |
private static class |
Functions.ConstantFunction<E> |
private static class |
Functions.ForMapWithDefault<K,V> |
private static class |
Functions.FunctionComposition<A,B,C> |
private static class |
Functions.FunctionForMapNoDefault<K,V> |
private static class |
Functions.IdentityFunction |
private static class |
Functions.PredicateFunction<T> |
private static class |
Functions.SupplierFunction<T> |
private static class |
Functions.ToStringFunction |
private static class |
Suppliers.SupplierFunctionImpl |
Modifier and Type | Field and Description |
---|---|
private Function<? super B,? extends A> |
Converter.FunctionBasedConverter.backwardFunction |
private Function<A,? extends B> |
Functions.FunctionComposition.f |
(package private) Function<A,? extends B> |
Predicates.CompositionPredicate.f |
private Function<? super A,? extends B> |
Converter.FunctionBasedConverter.forwardFunction |
private Function<F,? extends T> |
FunctionalEquivalence.function |
(package private) Function<? super F,T> |
Suppliers.SupplierComposition.function |
private Function<B,C> |
Functions.FunctionComposition.g |
Modifier and Type | Method and Description |
---|---|
static <A,B,C> Function<A,C> |
Functions.compose(Function<B,C> g,
Function<A,? extends B> f)
Returns the composition of two functions.
|
static <E> Function<java.lang.Object,E> |
Functions.constant(E value)
Creates a function that returns
value for any input. |
static <K,V> Function<K,V> |
Functions.forMap(java.util.Map<K,? extends V> map,
V defaultValue)
Returns a function which performs a map lookup with a default value.
|
static <K,V> Function<K,V> |
Functions.forMap(java.util.Map<K,V> map)
Returns a function which performs a map lookup.
|
static <T> Function<T,java.lang.Boolean> |
Functions.forPredicate(Predicate<T> predicate)
Creates a function that returns the same boolean output as the given predicate for all inputs.
|
static <T> Function<java.lang.Object,T> |
Functions.forSupplier(Supplier<T> supplier)
Returns a function that always returns the result of invoking
Supplier.get() on supplier , regardless of its input. |
static <E> Function<E,E> |
Functions.identity()
Returns the identity function.
|
static <T> Function<Supplier<T>,T> |
Suppliers.supplierFunction()
Returns a function that accepts a supplier and returns the result of
invoking
Supplier.get() on that supplier. |
static Function<java.lang.Object,java.lang.String> |
Functions.toStringFunction()
Returns a function that calls
toString() on its argument. |
Modifier and Type | Method and Description |
---|---|
static <F,T> Supplier<T> |
Suppliers.compose(Function<? super F,T> function,
Supplier<F> supplier)
Returns a new supplier which is the composition of the provided function
and supplier.
|
static <A,B,C> Function<A,C> |
Functions.compose(Function<B,C> g,
Function<A,? extends B> f)
Returns the composition of two functions.
|
static <A,B,C> Function<A,C> |
Functions.compose(Function<B,C> g,
Function<A,? extends B> f)
Returns the composition of two functions.
|
static <A,B> Predicate<A> |
Predicates.compose(Predicate<B> predicate,
Function<A,? extends B> function)
Returns the composition of a function and a predicate.
|
static <A,B> Converter<A,B> |
Converter.from(Function<? super A,? extends B> forwardFunction,
Function<? super B,? extends A> backwardFunction)
Returns a converter based on existing forward and backward functions.
|
static <A,B> Converter<A,B> |
Converter.from(Function<? super A,? extends B> forwardFunction,
Function<? super B,? extends A> backwardFunction)
Returns a converter based on existing forward and backward functions.
|
<F> Equivalence<F> |
Equivalence.onResultOf(Function<F,? extends T> function)
Returns a new equivalence relation for
F which evaluates equivalence by first applying
function to the argument, then evaluating using this . |
<V> Optional<V> |
Present.transform(Function<? super T,V> function) |
<V> Optional<V> |
Absent.transform(Function<? super T,V> function) |
abstract <V> Optional<V> |
Optional.transform(Function<? super T,V> function)
If the instance is present, it is transformed with the given
Function ; otherwise,
Optional.absent() is returned. |
Constructor and Description |
---|
CompositionPredicate(Predicate<B> p,
Function<A,? extends B> f) |
FunctionalEquivalence(Function<F,? extends T> function,
Equivalence<T> resultEquivalence) |
FunctionBasedConverter(Function<? super A,? extends B> forwardFunction,
Function<? super B,? extends A> backwardFunction) |
FunctionBasedConverter(Function<? super A,? extends B> forwardFunction,
Function<? super B,? extends A> backwardFunction) |
FunctionComposition(Function<B,C> g,
Function<A,? extends B> f) |
FunctionComposition(Function<B,C> g,
Function<A,? extends B> f) |
SupplierComposition(Function<? super F,T> function,
Supplier<F> supplier) |
Modifier and Type | Interface and Description |
---|---|
interface |
LoadingCache<K,V>
A semi-persistent mapping from keys to values.
|
Modifier and Type | Class and Description |
---|---|
class |
AbstractLoadingCache<K,V>
This class provides a skeletal implementation of the
Cache interface to minimize the
effort required to implement this interface. |
class |
ForwardingLoadingCache<K,V>
A cache which forwards all its method calls to another cache.
|
static class |
ForwardingLoadingCache.SimpleForwardingLoadingCache<K,V>
A simplified version of
ForwardingLoadingCache where subclasses can pass in an already
constructed LoadingCache as the delegete. |
(package private) static class |
LocalCache.LoadingSerializationProxy<K,V>
Serializes the configuration of a LocalCache, reconsitituting it as an LoadingCache using
CacheBuilder upon deserialization.
|
(package private) static class |
LocalCache.LocalLoadingCache<K,V> |
Modifier and Type | Field and Description |
---|---|
private Function<K,V> |
CacheLoader.FunctionToCacheLoader.computingFunction |
Modifier and Type | Method and Description |
---|---|
static <K,V> CacheLoader<K,V> |
CacheLoader.from(Function<K,V> function)
Returns a cache loader based on an existing function instance.
|
Constructor and Description |
---|
FunctionToCacheLoader(Function<K,V> computingFunction) |
Modifier and Type | Class and Description |
---|---|
private static class |
FluentIterable.FromIterableFunction<E>
Function that transforms
Iterable<E> into a fluent iterable. |
private static class |
Interners.InternerFunction<E> |
private static class |
Maps.BiMapConverter<A,B> |
private static class |
Maps.EntryFunction |
Modifier and Type | Field and Description |
---|---|
(package private) Function<? super K,? extends V> |
ComputingConcurrentHashMap.computingFunction |
(package private) Function<? super K,? extends V> |
ComputingConcurrentHashMap.ComputingValueReference.computingFunction |
(package private) Function<? super K,? extends V> |
ComputingConcurrentHashMap.ComputingSerializationProxy.computingFunction |
(package private) Function<? super K,? extends V> |
MapMaker.NullComputingConcurrentMap.computingFunction |
(package private) Function<? super F,? extends T> |
Lists.TransformingSequentialList.function |
(package private) Function<? super F,? extends T> |
Lists.TransformingRandomAccessList.function |
(package private) Function<F,? extends T> |
ByFunctionOrdering.function |
(package private) Function<? super F,? extends T> |
Collections2.TransformedCollection.function |
(package private) Function<? super K,V> |
Maps.AsMapView.function |
private Function<? super K,V> |
Maps.NavigableAsMapView.function |
(package private) Function<? super V1,V2> |
Tables.TransformedTable.function |
private static Function<Range,Cut> |
Range.LOWER_BOUND_FN |
private static Function<Table.Cell<?,?,?>,Table.Cell<?,?,?>> |
Tables.TransposeTable.TRANSPOSE_CELL |
private static Function<? extends java.util.Map<?,?>,? extends java.util.Map<?,?>> |
Tables.UNMODIFIABLE_WRAPPER |
private static Function<Range,Cut> |
Range.UPPER_BOUND_FN |
Modifier and Type | Method and Description |
---|---|
(package private) static <K,V1,V2> Function<java.util.Map.Entry<K,V1>,java.util.Map.Entry<K,V2>> |
Maps.asEntryToEntryFunction(Maps.EntryTransformer<? super K,? super V1,V2> transformer)
Views an entry transformer as a function from entries to entries.
|
(package private) static <K,V1,V2> Function<java.util.Map.Entry<K,V1>,V2> |
Maps.asEntryToValueFunction(Maps.EntryTransformer<? super K,? super V1,V2> transformer)
Views an entry transformer as a function from
Entry to values. |
static <E> Function<E,E> |
Interners.asFunction(Interner<E> interner)
Returns a function that delegates to the
Interner.intern(E) method of the given interner. |
(package private) static <K,V1,V2> Function<V1,V2> |
Maps.asValueToValueFunction(Maps.EntryTransformer<? super K,V1,V2> transformer,
K key) |
(package private) Function<Table.Cell<R,C,V1>,Table.Cell<R,C,V2>> |
Tables.TransformedTable.cellFunction() |
(package private) static <K> Function<java.util.Map.Entry<K,?>,K> |
Maps.keyFunction() |
(package private) static <C extends java.lang.Comparable<?>> |
Range.lowerBoundFn() |
private static <T> Function<java.lang.Iterable<? extends T>,java.util.Iterator<? extends T>> |
Iterables.toIterator() |
private static <K,V> Function<java.util.Map<K,V>,java.util.Map<K,V>> |
Tables.unmodifiableWrapper() |
(package private) static <C extends java.lang.Comparable<?>> |
Range.upperBoundFn() |
(package private) static <V> Function<java.util.Map.Entry<?,V>,V> |
Maps.valueFunction() |
Modifier and Type | Method and Description |
---|---|
(package private) static <K,V1,V2> Maps.EntryTransformer<K,V1,V2> |
Maps.asEntryTransformer(Function<? super V1,V2> function)
Views a function as an entry transformer that ignores the entry key.
|
static <K,V> java.util.NavigableMap<K,V> |
Maps.asMap(java.util.NavigableSet<K> set,
Function<? super K,V> function)
Returns a view of the navigable set as a map, mapping keys from the set
according to the specified function.
|
static <K,V> java.util.Map<K,V> |
Maps.asMap(java.util.Set<K> set,
Function<? super K,V> function)
Returns a live
Map view whose keys are the contents of set
and whose values are computed on demand using function . |
static <K,V> java.util.SortedMap<K,V> |
Maps.asMap(java.util.SortedSet<K> set,
Function<? super K,V> function)
Returns a view of the sorted set as a map, mapping keys from the set
according to the specified function.
|
(package private) static <K,V> java.util.Iterator<java.util.Map.Entry<K,V>> |
Maps.asMapEntryIterator(java.util.Set<K> set,
Function<? super K,V> function) |
(package private) static <K,V> java.util.SortedMap<K,V> |
Maps.asMapSortedIgnoreNavigable(java.util.SortedSet<K> set,
Function<? super K,V> function) |
static <E,K> int |
SortedLists.binarySearch(java.util.List<E> list,
Function<? super E,K> keyFunction,
K key,
java.util.Comparator<? super K> keyComparator,
SortedLists.KeyPresentBehavior presentBehavior,
SortedLists.KeyAbsentBehavior absentBehavior)
Binary searches the list for the specified key, using the specified key function.
|
static <E,K extends java.lang.Comparable> |
SortedLists.binarySearch(java.util.List<E> list,
Function<? super E,K> keyFunction,
K key,
SortedLists.KeyPresentBehavior presentBehavior,
SortedLists.KeyAbsentBehavior absentBehavior)
Binary searches the list for the specified key, using the specified key function.
|
(package private) V |
ComputingConcurrentHashMap.ComputingSegment.getOrCompute(K key,
int hash,
Function<? super K,? extends V> computingFunction) |
<K> ImmutableListMultimap<K,E> |
FluentIterable.index(Function<? super E,K> keyFunction)
Creates an index
ImmutableListMultimap that contains the results of applying a
specified function to each item in this FluentIterable of values. |
static <K,V> ImmutableListMultimap<K,V> |
Multimaps.index(java.lang.Iterable<V> values,
Function<? super V,K> keyFunction)
Creates an index
ImmutableListMultimap that contains the results of
applying a specified function to each item in an Iterable of
values. |
static <K,V> ImmutableListMultimap<K,V> |
Multimaps.index(java.util.Iterator<V> values,
Function<? super V,K> keyFunction)
Creates an index
ImmutableListMultimap that contains the results of
applying a specified function to each item in an Iterator of
values. |
(package private) abstract <K extends K0,V extends V0> |
GenericMapMaker.makeComputingMap(Function<? super K,? extends V> computingFunction)
Deprecated.
|
(package private) <K,V> java.util.concurrent.ConcurrentMap<K,V> |
MapMaker.makeComputingMap(Function<? super K,? extends V> computingFunction)
Deprecated.
Caching functionality in
MapMaker has been moved to
CacheBuilder , with MapMaker.makeComputingMap(com.google.common.base.Function<? super K, ? extends V>) being replaced
by CacheBuilder.build(com.google.common.cache.CacheLoader<? super K1, V1>) . See the
MapMaker
Migration Guide for more details. |
(package private) static <K,V> java.util.SortedMap<K,V> |
Platform.mapsAsMapSortedSet(java.util.SortedSet<K> set,
Function<? super K,V> function) |
<F> Ordering<F> |
Ordering.onResultOf(Function<F,? extends T> function)
Returns a new ordering on
F which orders elements by first applying
a function to them, then comparing those results using this . |
<V> ImmutableMap<E,V> |
FluentIterable.toMap(Function<? super E,V> valueFunction)
Returns an immutable map for which the elements of this
FluentIterable are the keys in
the same order, mapped to values by the given function. |
static <K,V> ImmutableMap<K,V> |
Maps.toMap(java.lang.Iterable<K> keys,
Function<? super K,V> valueFunction)
Returns an immutable map whose keys are the distinct elements of
keys and whose value for each key was computed by valueFunction . |
static <K,V> ImmutableMap<K,V> |
Maps.toMap(java.util.Iterator<K> keys,
Function<? super K,V> valueFunction)
Returns an immutable map whose keys are the distinct elements of
keys and whose value for each key was computed by valueFunction . |
static <F,T> java.util.Collection<T> |
Collections2.transform(java.util.Collection<F> fromCollection,
Function<? super F,T> function)
Returns a collection that applies
function to each element of
fromCollection . |
<T> FluentIterable<T> |
FluentIterable.transform(Function<? super E,T> function)
Returns a fluent iterable that applies
function to each element of this
fluent iterable. |
static <F,T> java.lang.Iterable<T> |
Iterables.transform(java.lang.Iterable<F> fromIterable,
Function<? super F,? extends T> function)
Returns an iterable that applies
function to each element of fromIterable . |
static <F,T> java.util.Iterator<T> |
Iterators.transform(java.util.Iterator<F> fromIterator,
Function<? super F,? extends T> function)
Returns an iterator that applies
function to each element of fromIterator . |
static <F,T> java.util.List<T> |
Lists.transform(java.util.List<F> fromList,
Function<? super F,? extends T> function)
Returns a list that applies
function to each element of fromList . |
<T> FluentIterable<T> |
FluentIterable.transformAndConcat(Function<? super E,? extends java.lang.Iterable<? extends T>> function)
Applies
function to each element of this fluent iterable and returns
a fluent iterable with the concatenated combination of results. |
static <K,V1,V2> ListMultimap<K,V2> |
Multimaps.transformValues(ListMultimap<K,V1> fromMultimap,
Function<? super V1,V2> function)
Returns a view of a
ListMultimap where each value is transformed by
a function. |
static <K,V1,V2> java.util.Map<K,V2> |
Maps.transformValues(java.util.Map<K,V1> fromMap,
Function<? super V1,V2> function)
Returns a view of a map where each value is transformed by a function.
|
static <K,V1,V2> Multimap<K,V2> |
Multimaps.transformValues(Multimap<K,V1> fromMultimap,
Function<? super V1,V2> function)
Returns a view of a multimap where each value is transformed by a function.
|
static <K,V1,V2> java.util.NavigableMap<K,V2> |
Maps.transformValues(java.util.NavigableMap<K,V1> fromMap,
Function<? super V1,V2> function)
Returns a view of a navigable map where each value is transformed by a
function.
|
static <K,V1,V2> java.util.SortedMap<K,V2> |
Maps.transformValues(java.util.SortedMap<K,V1> fromMap,
Function<? super V1,V2> function)
Returns a view of a sorted map where each value is transformed by a
function.
|
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.
|
<K> ImmutableMap<K,E> |
FluentIterable.uniqueIndex(Function<? super E,K> keyFunction)
Returns an immutable map for which the
Map.values() are the elements of this
FluentIterable in the given order, and each key is the product of invoking a supplied
function on its corresponding value. |
static <K,V> ImmutableMap<K,V> |
Maps.uniqueIndex(java.lang.Iterable<V> values,
Function<? super V,K> keyFunction)
Returns an immutable map for which the
Map.values() are the given
elements in the given order, and each key is the product of invoking a
supplied function on its corresponding value. |
static <K,V> ImmutableMap<K,V> |
Maps.uniqueIndex(java.util.Iterator<V> values,
Function<? super V,K> keyFunction)
Returns an immutable map for which the
Map.values() are the given
elements in the given order, and each key is the product of invoking a
supplied function on its corresponding value. |
Constructor and Description |
---|
AsMapView(java.util.Set<K> set,
Function<? super K,V> function) |
ByFunctionOrdering(Function<F,? extends T> function,
Ordering<T> ordering) |
ComputingConcurrentHashMap(MapMaker builder,
Function<? super K,? extends V> computingFunction)
Creates a new, empty map with the specified strategy, initial capacity, load factor and
concurrency level.
|
ComputingMapAdapter(MapMaker mapMaker,
Function<? super K,? extends V> computingFunction) |
ComputingSerializationProxy(MapMakerInternalMap.Strength keyStrength,
MapMakerInternalMap.Strength valueStrength,
Equivalence<java.lang.Object> keyEquivalence,
Equivalence<java.lang.Object> valueEquivalence,
long expireAfterWriteNanos,
long expireAfterAccessNanos,
int maximumSize,
int concurrencyLevel,
MapMaker.RemovalListener<? super K,? super V> removalListener,
java.util.concurrent.ConcurrentMap<K,V> delegate,
Function<? super K,? extends V> computingFunction) |
ComputingValueReference(Function<? super K,? extends V> computingFunction) |
NavigableAsMapView(java.util.NavigableSet<K> ks,
Function<? super K,V> vFunction) |
NullComputingConcurrentMap(MapMaker mapMaker,
Function<? super K,? extends V> computingFunction) |
SortedAsMapView(java.util.SortedSet<K> set,
Function<? super K,V> function) |
TransformedCollection(java.util.Collection<F> fromCollection,
Function<? super F,? extends T> function) |
TransformedTable(Table<R,C,V1> fromTable,
Function<? super V1,V2> function) |
TransformingRandomAccessList(java.util.List<F> fromList,
Function<? super F,? extends T> function) |
TransformingSequentialList(java.util.List<F> fromList,
Function<? super F,? extends T> function) |
Modifier and Type | Field and Description |
---|---|
private Function<java.lang.String,java.lang.String> |
Escaper.asFunction |
Modifier and Type | Method and Description |
---|---|
Function<java.lang.String,java.lang.String> |
Escaper.asFunction()
Returns a
Function that invokes Escaper.escape(String) on this escaper. |
Modifier and Type | Class and Description |
---|---|
private static class |
Doubles.DoubleConverter |
private static class |
Floats.FloatConverter |
private static class |
Ints.IntConverter |
private static class |
Longs.LongConverter |
private static class |
Shorts.ShortConverter |
Modifier and Type | Field and Description |
---|---|
private static Function<java.lang.reflect.Type,java.lang.String> |
Types.TYPE_NAME
Class#toString without the "class " and "interface " prefixes
|
Modifier and Type | Field and Description |
---|---|
(package private) Function<? super java.lang.Exception,X> |
Futures.MappingCheckedFuture.mapper |
Modifier and Type | Method and Description |
---|---|
private static <I,O> AsyncFunction<I,O> |
Futures.asAsyncFunction(Function<? super I,? extends O> function)
Wraps the given function as an AsyncFunction.
|
static <I,O> java.util.concurrent.Future<O> |
Futures.lazyTransform(java.util.concurrent.Future<I> input,
Function<? super I,? extends O> function)
Like
Futures.transform(ListenableFuture, Function) except that the
transformation function is invoked on each call to
get() on the returned future. |
static <V,X extends java.lang.Exception> |
Futures.makeChecked(ListenableFuture<V> future,
Function<? super java.lang.Exception,X> mapper)
Creates a
CheckedFuture out of a normal ListenableFuture
and a Function that maps from Exception instances into the
appropriate checked type. |
static <I,O> ListenableFuture<O> |
Futures.transform(ListenableFuture<I> input,
Function<? super I,? extends O> function)
Returns a new
ListenableFuture whose result is the product of
applying the given Function to the result of the given Future . |
static <I,O> ListenableFuture<O> |
Futures.transform(ListenableFuture<I> input,
Function<? super I,? extends O> function,
java.util.concurrent.Executor executor)
Returns a new
ListenableFuture whose result is the product of
applying the given Function to the result of the given Future . |
Constructor and Description |
---|
MappingCheckedFuture(ListenableFuture<V> delegate,
Function<? super java.lang.Exception,X> mapper) |