Uses of Interface
com.google.common.base.Function
Packages that use Function
Package
Description
Basic utility libraries and interfaces.
Discouraged (in favor of Caffeine) caching utilities.
Collection interfaces and implementations, and other utilities for collections.
Interfaces, utilities, and simple implementations of escapers and encoders.
An API for representing graph (node and edge) data.
Static utilities for the eight primitive types and
void
, and value types for treating
them as unsigned or storing them in immutable arrays.Testing utilities.
Concurrency utilities.
-
Uses of Function in com.google.common.base
Subinterfaces of Function in com.google.common.baseClasses in com.google.common.base that implement FunctionModifier and TypeClassDescriptionprivate static final class
class
Converter<A,
B> A function fromA
toB
with an associated reverse function fromB
toA
; used for converting back and forth between different representations of the same information.private static final class
private static final class
private static final class
A converter that always converts or reverses an object to itself.private static final class
private static final class
Enums.StringConverter<T extends Enum<T>>
private static class
private static class
private static class
private static class
private static enum
private static class
private static class
private static enum
private static enum
Fields in com.google.common.base declared as FunctionModifier and TypeFieldDescriptionConverter.FunctionBasedConverter.backwardFunction
Functions.FunctionComposition.f
Predicates.CompositionPredicate.f
Converter.FunctionBasedConverter.forwardFunction
FunctionalEquivalence.function
Suppliers.SupplierComposition.function
Functions.FunctionComposition.g
Methods in com.google.common.base that return FunctionModifier and TypeMethodDescriptionstatic <A,
B, C> Function <A, C> Returns the composition of two functions.Functions.constant
(E value) Returns a function that ignores its input and always returnsvalue
.static <K,
V> Function <K, V> Returns a function which performs a map lookup with a default value.static <K,
V> Function <K, V> Returns a function which performs a map lookup.Functions.forPredicate
(Predicate<T> predicate) Creates a function that returns the same boolean output as the given predicate for all inputs.static <F,
T> Function <F, T> Functions.forSupplier
(Supplier<T> supplier) Returns a function that ignores its input and returns the result ofsupplier.get()
.static <E> Function
<E, E> Functions.identity()
Returns the identity function.Suppliers.supplierFunction()
Returns a function that accepts a supplier and returns the result of invokingSupplier.get()
on that supplier.Functions.toStringFunction()
A function equivalent to the method referenceObject::toString
, for users not yet using Java 8.Methods in com.google.common.base with parameters of type FunctionModifier and TypeMethodDescriptionstatic <A,
B, C> Function <A, C> Returns the composition of two functions.static <A,
B> Predicate <A> Returns the composition of a function and a predicate.static <F,
T> Supplier <T> Returns a new supplier which is the composition of the provided function and supplier.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 separate forward and backward functions.final <F> Equivalence
<F> Equivalence.onResultOf
(Function<? super F, ? extends T> function) Returns a new equivalence relation forF
which evaluates equivalence by first applyingfunction
to the argument, then evaluating usingthis
.<V> Optional
<V> abstract <V> Optional
<V> If the instance is present, it is transformed with the givenFunction
; otherwise,Optional.absent()
is returned.<V> Optional
<V> Constructors in com.google.common.base with parameters of type FunctionModifierConstructorDescriptionprivate
(package private)
FunctionalEquivalence
(Function<? super F, ? extends T> function, Equivalence<T> resultEquivalence) private
FunctionBasedConverter
(Function<? super A, ? extends B> forwardFunction, Function<? super B, ? extends A> backwardFunction) (package private)
-
Uses of Function in com.google.common.cache
Subinterfaces of Function in com.google.common.cacheModifier and TypeInterfaceDescriptioninterface
LoadingCache<K,
V> A semi-persistent mapping from keys to values.Classes in com.google.common.cache that implement FunctionModifier and TypeClassDescriptionclass
AbstractLoadingCache<K,
V> This class provides a skeletal implementation of theCache
interface to minimize the effort required to implement this interface.class
A cache which forwards all its method calls to another cache.static class
A simplified version ofForwardingLoadingCache
where subclasses can pass in an already constructedLoadingCache
as the delegate.(package private) static final class
Serializes the configuration of a LocalCache, reconstituting it as an LoadingCache using CacheBuilder upon deserialization.(package private) static class
Fields in com.google.common.cache declared as FunctionMethods in com.google.common.cache with parameters of type FunctionModifier and TypeMethodDescriptionstatic <K,
V> CacheLoader <K, V> Returns a cache loader that usesfunction
to load keys, without supporting either reloading or bulk loading.Constructors in com.google.common.cache with parameters of type Function -
Uses of Function in com.google.common.collect
Classes in com.google.common.collect that implement FunctionModifier and TypeClassDescriptionprivate static class
Function that transformsIterable<E>
into a fluent iterable.private static class
private static final class
Maps.BiMapConverter<A,
B> private static enum
Fields in com.google.common.collect declared as FunctionModifier and TypeFieldDescriptionByFunctionOrdering.function
Collections2.TransformedCollection.function
Lists.TransformingRandomAccessList.function
Lists.TransformingSequentialList.function
Maps.AsMapView.function
Maps.NavigableAsMapView.function
Tables.TransformedTable.function
Tables.UNMODIFIABLE_WRAPPER
Methods in com.google.common.collect that return FunctionModifier and TypeMethodDescriptionMaps.asEntryToEntryFunction
(Maps.EntryTransformer<? super K, ? super V1, V2> transformer) Views an entry transformer as a function from entries to entries.Maps.asEntryToValueFunction
(Maps.EntryTransformer<? super K, ? super V1, V2> transformer) Views an entry transformer as a function fromEntry
to values.static <E> Function
<E, E> Interners.asFunction
(Interner<E> interner) Returns a function that delegates to theInterner.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()
Maps.keyFunction()
Tables.unmodifiableWrapper()
Maps.valueFunction()
Methods in com.google.common.collect with parameters of type FunctionModifier and TypeMethodDescription(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> NavigableMap <K, V> Maps.asMap
(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> Map <K, V> Returns a liveMap
view whose keys are the contents ofset
and whose values are computed on demand usingfunction
.static <K,
V> SortedMap <K, V> Returns a view of the sorted set as a map, mapping keys from the set according to the specified function.Maps.asMapEntryIterator
(Set<K> set, Function<? super K, V> function) static <E,
K extends Comparable>
intSortedLists.binarySearch
(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.static <E,
K> int SortedLists.binarySearch
(List<E> list, Function<? super E, K> keyFunction, K key, Comparator<? super K> keyComparator, SortedLists.KeyPresentBehavior presentBehavior, SortedLists.KeyAbsentBehavior absentBehavior) Binary searches the list for the specified key, using the specified key function.final <K> ImmutableListMultimap
<K, E> Creates an indexImmutableListMultimap
that contains the results of applying a specified function to each item in thisFluentIterable
of values.static <K,
V> ImmutableListMultimap <K, V> Creates an indexImmutableListMultimap
that contains the results of applying a specified function to each item in anIterable
of values.static <K,
V> ImmutableListMultimap <K, V> Creates an indexImmutableListMultimap
that contains the results of applying a specified function to each item in anIterator
of values.<F> Ordering
<F> Ordering.onResultOf
(Function<F, ? extends T> function) Returns a new ordering onF
which orders elements by first applying a function to them, then comparing those results usingthis
.final <V> ImmutableMap
<E, V> Returns an immutable map whose keys are the distinct elements of thisFluentIterable
and whose value for each key was computed byvalueFunction
.static <K,
V> ImmutableMap <K, V> Returns an immutable map whose keys are the distinct elements ofkeys
and whose value for each key was computed byvalueFunction
.static <K,
V> ImmutableMap <K, V> Returns an immutable map whose keys are the distinct elements ofkeys
and whose value for each key was computed byvalueFunction
.static <F,
T> Collection <T> Collections2.transform
(Collection<F> fromCollection, Function<? super F, T> function) Returns a collection that appliesfunction
to each element offromCollection
.final <T> FluentIterable
<T> Returns a fluent iterable that appliesfunction
to each element of this fluent iterable.static <F,
T> Iterable <T> Returns a view containing the result of applyingfunction
to each element offromIterable
.static <F,
T> Iterator <T> Returns a view containing the result of applyingfunction
to each element offromIterator
.static <F,
T> List <T> Returns a list that appliesfunction
to each element offromList
.<T> FluentIterable
<T> FluentIterable.transformAndConcat
(Function<? super E, ? extends Iterable<? extends T>> function) Appliesfunction
to each element of this fluent iterable and returns a fluent iterable with the concatenated combination of results.static <K,
V1, V2>
Map<K, V2> Maps.transformValues
(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>
NavigableMap<K, V2> Maps.transformValues
(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>
SortedMap<K, V2> Maps.transformValues
(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 <K,
V1, V2>
ListMultimap<K, V2> Multimaps.transformValues
(ListMultimap<K, V1> fromMultimap, Function<? super V1, V2> function) Returns a view of aListMultimap
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 <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.final <K> ImmutableMap
<K, E> FluentIterable.uniqueIndex
(Function<? super E, K> keyFunction) Returns a map with the contents of thisFluentIterable
as itsvalues
, indexed by keys derived from those values.static <K,
V> ImmutableMap <K, V> Maps.uniqueIndex
(Iterable<V> values, Function<? super V, K> keyFunction) Returns a map with the givenvalues
, indexed by keys derived from those values.static <K,
V> ImmutableMap <K, V> Maps.uniqueIndex
(Iterator<V> values, Function<? super V, K> keyFunction) Returns a map with the givenvalues
, indexed by keys derived from those values.private static <K,
V> ImmutableMap <K, V> Maps.uniqueIndex
(Iterator<V> values, Function<? super V, K> keyFunction, ImmutableMap.Builder<K, V> builder) static <T> TreeTraverser
<T> Deprecated.Constructors in com.google.common.collect with parameters of type FunctionModifierConstructorDescription(package private)
(package private)
(package private)
NavigableAsMapView
(NavigableSet<K> ks, Function<? super K, V> vFunction) (package private)
(package private)
TransformedCollection
(Collection<F> fromCollection, Function<? super F, ? extends T> function) (package private)
(package private)
(package private)
-
Uses of Function in com.google.common.escape
Fields in com.google.common.escape declared as FunctionMethods in com.google.common.escape that return FunctionModifier and TypeMethodDescriptionEscaper.asFunction()
Returns aFunction
that invokesEscaper.escape(String)
on this escaper. -
Uses of Function in com.google.common.graph
Methods in com.google.common.graph that return FunctionModifier and TypeMethodDescriptionprivate static <N,
E> Function <E, N> ImmutableNetwork.adjacentNodeFn
(Network<N, E> network, N node) private static <N,
E> Function <E, N> ImmutableNetwork.sourceNodeFn
(Network<N, E> network) private static <N,
E> Function <E, N> ImmutableNetwork.targetNodeFn
(Network<N, E> network) Methods in com.google.common.graph with parameters of type FunctionModifier and TypeMethodDescription(package private) static <N,
V> DirectedGraphConnections <N, V> DirectedGraphConnections.ofImmutable
(N thisNode, Iterable<EndpointPair<N>> incidentEdges, Function<N, V> successorNodeToValueFn) -
Uses of Function in com.google.common.primitives
Classes in com.google.common.primitives that implement FunctionModifier and TypeClassDescriptionprivate static final class
private static final class
private static final class
private static final class
private static final class
-
Uses of Function in com.google.common.testing
Methods in com.google.common.testing with parameters of type FunctionModifier and TypeMethodDescriptionprivate static <T> void
ForwardingWrapperTester.testEquals
(Class<T> interfaceType, Function<? super T, ? extends T> wrapperFunction) private static <T> void
ForwardingWrapperTester.testExceptionPropagation
(Class<T> interfaceType, Method method, Function<? super T, ? extends T> wrapperFunction) <T> void
ForwardingWrapperTester.testForwarding
(Class<T> interfaceType, Function<? super T, ? extends T> wrapperFunction) Tests that the forwarding wrapper returned bywrapperFunction
properly forwards method calls with parameters passed as is, return value returned as is, and exceptions propagated as is.(package private) void
ForwardingWrapperTester.InteractionTester.testInteraction
(Function<? super T, ? extends T> wrapperFunction) private static <T> void
ForwardingWrapperTester.testSuccessfulForwarding
(Class<T> interfaceType, Method method, Function<? super T, ? extends T> wrapperFunction) private static <T> void
ForwardingWrapperTester.testToString
(Class<T> interfaceType, Function<? super T, ? extends T> wrapperFunction) -
Uses of Function in com.google.common.util.concurrent
Methods in com.google.common.util.concurrent with parameters of type FunctionModifier and TypeMethodDescriptionfinal <X extends Throwable>
FluentFuture<V> FluentFuture.catching
(Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) Returns aFuture
whose result is taken from thisFuture
or, if thisFuture
fails with the givenexceptionType
, from the result provided by thefallback
.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
.(package private) static <V,
X extends Throwable>
ListenableFuture<V> AbstractCatchingFuture.create
(ListenableFuture<? extends V> input, Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) (package private) static <I,
O> ListenableFuture <O> AbstractTransformFuture.create
(ListenableFuture<I> input, Function<? super I, ? extends O> function, Executor executor) (package private) V
AbstractCatchingFuture.CatchingFuture.doFallback
(Function<? super X, ? extends V> fallback, X cause) (package private) O
AbstractTransformFuture.TransformFuture.doTransform
(Function<? super I, ? extends O> function, I input) 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.final <T> FluentFuture
<T> Returns a newFuture
whose result is derived from the result of thisFuture
.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
.Constructors in com.google.common.util.concurrent with parameters of type FunctionModifierConstructorDescription(package private)
CatchingFuture
(ListenableFuture<? extends V> input, Class<X> exceptionType, Function<? super X, ? extends V> fallback) (package private)
TransformFuture
(ListenableFuture<? extends I> inputFuture, Function<? super I, ? extends O> function)
Traverser.forTree(com.google.common.graph.SuccessorsFunction<N>)
instead.