Uses of Interface
java.util.function.Supplier
Packages that use Supplier
Package
Description
Provides classes that are fundamental to the design of the Java
programming language.
Provides classfile parsing, generation, and transformation library.
Classes to support module descriptors and creating configurations of modules
by means of resolution and service binding.
HTTP Client and WebSocket APIs
Contains the collections framework, some internationalization support classes,
a service loader, properties, random number generation, string parsing
and scanning classes, base64 encoding and decoding, a bit array, and
several miscellaneous utility classes.
Utility classes commonly useful in concurrent programming.
Provides the classes and interfaces of
the Java 2 platform's core logging facilities.
Classes to support functional-style operations on streams of elements, such
as map-reduce transformations on collections.
Contains interfaces and classes needed by language runtimes to implement
their own language-specific object models and type conversions.
Provides interfaces for creating tools, such as a Read-Eval-Print Loop (REPL),
which interactively evaluate "snippets" of Java programming language code.
-
Uses of Supplier in java.lang
Modifier and TypeMethodDescriptiondefault voidSystem.Logger.log(System.Logger.Level level, Supplier<String> msgSupplier) Logs a lazily supplied message.default voidSystem.Logger.log(System.Logger.Level level, Supplier<String> msgSupplier, Throwable thrown) Logs a lazily supplied message associated with a given throwable.ScopedValue.orElseThrow(Supplier<? extends X> exceptionSupplier) Returns the value of this scoped value if bound in the current thread, otherwise throws an exception produced by the exception supplying function.static <S> ThreadLocal<S> ThreadLocal.withInitial(Supplier<? extends S> supplier) Creates a thread local variable. -
Uses of Supplier in java.lang.classfile
Methods in java.lang.classfile with parameters of type SupplierModifier and TypeMethodDescriptiondefault ClassHierarchyResolverClassHierarchyResolver.cached(Supplier<Map<ClassDesc, ClassHierarchyResolver.ClassHierarchyInfo>> cacheFactory) Returns aClassHierarchyResolverthat caches class hierarchy information from this resolver.static ClassTransformClassTransform.ofStateful(Supplier<ClassTransform> supplier) Creates a stateful class transform from aSupplier.static CodeTransformCodeTransform.ofStateful(Supplier<CodeTransform> supplier) Creates a stateful code transform from aSupplier.static FieldTransformFieldTransform.ofStateful(Supplier<FieldTransform> supplier) Creates a stateful field transform from aSupplier.static MethodTransformMethodTransform.ofStateful(Supplier<MethodTransform> supplier) Creates a stateful method transform from aSupplier. -
Uses of Supplier in java.lang.module
Methods in java.lang.module with parameters of type SupplierModifier and TypeMethodDescriptionstatic ModuleDescriptorModuleDescriptor.read(InputStream in, Supplier<Set<String>> packageFinder) Reads the binary form of a module declaration from an input stream as a module descriptor.static ModuleDescriptorModuleDescriptor.read(ByteBuffer bb, Supplier<Set<String>> packageFinder) Reads the binary form of a module declaration from a byte buffer as a module descriptor. -
Uses of Supplier in java.net.http
Methods in java.net.http with parameters of type SupplierModifier and TypeMethodDescriptionstatic HttpRequest.BodyPublisherHttpRequest.BodyPublishers.ofInputStream(Supplier<? extends InputStream> streamSupplier) A request body publisher that reads its data from anInputStream. -
Uses of Supplier in java.util
Modifier and TypeInterfaceDescriptionstatic interfaceRepresents a service provider located byServiceLoader.Modifier and TypeMethodDescriptionIf a value is present, returns anOptionaldescribing the value, otherwise returns anOptionalproduced by the supplying function.If a value is present, returns the value, otherwise returns the result produced by the supplying function.Optional.orElseThrow(Supplier<? extends X> exceptionSupplier) If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.<X extends Throwable>
doubleOptionalDouble.orElseThrow(Supplier<? extends X> exceptionSupplier) If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.<X extends Throwable>
intOptionalInt.orElseThrow(Supplier<? extends X> exceptionSupplier) If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.<X extends Throwable>
longOptionalLong.orElseThrow(Supplier<? extends X> exceptionSupplier) If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.static <T> TObjects.requireNonNull(T obj, Supplier<String> messageSupplier) Checks that the specified object reference is notnulland throws a customizedNullPointerExceptionif it is.static <T> TObjects.requireNonNullElseGet(T obj, Supplier<? extends T> supplier) Returns the first argument if it is non-nulland otherwise the value fromsupplier.get()if it is non-null. -
Uses of Supplier in java.util.concurrent
Subinterfaces of Supplier in java.util.concurrentModifier and TypeInterfaceDescriptionstatic interfacePreview.Represents a subtask forked withStructuredTaskScope.fork(Callable)PREVIEW.Methods in java.util.concurrent with parameters of type SupplierModifier and TypeMethodDescriptionCompletableFuture.completeAsync(Supplier<? extends T> supplier) Completes this CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the default executor.CompletableFuture.completeAsync(Supplier<? extends T> supplier, Executor executor) Completes this CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the given executor.static <U> CompletableFuture<U> CompletableFuture.supplyAsync(Supplier<U> supplier) Returns a new CompletableFuture that is asynchronously completed by a task running in theForkJoinPool.commonPool()with the value obtained by calling the given Supplier.static <U> CompletableFuture<U> CompletableFuture.supplyAsync(Supplier<U> supplier, Executor executor) Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor with the value obtained by calling the given Supplier. -
Uses of Supplier in java.util.logging
Methods in java.util.logging with parameters of type SupplierModifier and TypeMethodDescriptionvoidLog a CONFIG message, which is only to be constructed if the logging level is such that the message will actually be logged.voidLog a FINE message, which is only to be constructed if the logging level is such that the message will actually be logged.voidLog a FINER message, which is only to be constructed if the logging level is such that the message will actually be logged.voidLog a FINEST message, which is only to be constructed if the logging level is such that the message will actually be logged.voidLog a INFO message, which is only to be constructed if the logging level is such that the message will actually be logged.voidLog a lazily constructed message, with associated Throwable information.voidLog a message, which is only to be constructed if the logging level is such that the message will actually be logged.voidLogger.logp(Level level, String sourceClass, String sourceMethod, Throwable thrown, Supplier<String> msgSupplier) Log a lazily constructed message, specifying source class and method, with associated Throwable information.voidLog a lazily constructed message, specifying source class and method, with no arguments.voidLog a SEVERE message, which is only to be constructed if the logging level is such that the message will actually be logged.voidLog a WARNING message, which is only to be constructed if the logging level is such that the message will actually be logged. -
Uses of Supplier in java.util.stream
Methods in java.util.stream that return SupplierModifier and TypeMethodDescriptionstatic <A> Supplier<A> Gatherer.defaultInitializer()Returns an initializer which is the default initializer of a Gatherer.Gatherer.initializer()A function that produces an instance of the intermediate state used for this gathering operation.Collector.supplier()A function that creates and returns a new mutable result container.Methods in java.util.stream with parameters of type SupplierModifier and TypeMethodDescription<R> RDoubleStream.collect(Supplier<R> supplier, ObjDoubleConsumer<R> accumulator, BiConsumer<R, R> combiner) Performs a mutable reduction operation on the elements of this stream.<R> RIntStream.collect(Supplier<R> supplier, ObjIntConsumer<R> accumulator, BiConsumer<R, R> combiner) Performs a mutable reduction operation on the elements of this stream.<R> RLongStream.collect(Supplier<R> supplier, ObjLongConsumer<R> accumulator, BiConsumer<R, R> combiner) Performs a mutable reduction operation on the elements of this stream.<R> RStream.collect(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator, BiConsumer<R, R> combiner) Performs a mutable reduction operation on the elements of this stream.static DoubleStreamStreamSupport.doubleStream(Supplier<? extends Spliterator.OfDouble> supplier, int characteristics, boolean parallel) Creates a new sequential or parallelDoubleStreamfrom aSupplierofSpliterator.OfDouble.static <T,R> Gatherer <T, ?, R> Gatherers.fold(Supplier<R> initial, BiFunction<? super R, ? super T, ? extends R> folder) Returns a Gatherer that performs an ordered, reduction-like, transformation for scenarios where no combiner-function can be implemented, or for reductions which are intrinsically order-dependent.static <T> Stream<T> Returns an infinite sequential unordered stream where each element is generated by the providedSupplier.Collectors.groupingBy(Function<? super T, ? extends K> classifier, Supplier<M> mapFactory, Collector<? super T, A, D> downstream) Returns aCollectorimplementing a cascaded "group by" operation on input elements of typeT, grouping elements according to a classification function, and then performing a reduction operation on the values associated with a given key using the specified downstreamCollector.static <T, K, A, D, M extends ConcurrentMap<K,D>>
Collector<T, ?, M> Collectors.groupingByConcurrent(Function<? super T, ? extends K> classifier, Supplier<M> mapFactory, Collector<? super T, A, D> downstream) Returns a concurrentCollectorimplementing a cascaded "group by" operation on input elements of typeT, grouping elements according to a classification function, and then performing a reduction operation on the values associated with a given key using the specified downstreamCollector.static IntStreamStreamSupport.intStream(Supplier<? extends Spliterator.OfInt> supplier, int characteristics, boolean parallel) Creates a new sequential or parallelIntStreamfrom aSupplierofSpliterator.OfInt.static LongStreamStreamSupport.longStream(Supplier<? extends Spliterator.OfLong> supplier, int characteristics, boolean parallel) Creates a new sequential or parallelLongStreamfrom aSupplierofSpliterator.OfLong.static <T,A, R> Collector <T, A, R> Collector.of(Supplier<A> supplier, BiConsumer<A, T> accumulator, BinaryOperator<A> combiner, Function<A, R> finisher, Collector.Characteristics... characteristics) Returns a newCollectordescribed by the givensupplier,accumulator,combiner, andfinisherfunctions.static <T,R> Collector <T, R, R> Collector.of(Supplier<R> supplier, BiConsumer<R, T> accumulator, BinaryOperator<R> combiner, Collector.Characteristics... characteristics) Returns a newCollectordescribed by the givensupplier,accumulator, andcombinerfunctions.static <T,A, R> Gatherer <T, A, R> Gatherer.of(Supplier<A> initializer, Gatherer.Integrator<A, T, R> integrator, BinaryOperator<A> combiner, BiConsumer<A, Gatherer.Downstream<? super R>> finisher) Returns a new, parallelizable,Gathererdescribed by the giveninitializer,integrator,combinerandfinisher.static <T,A, R> Gatherer <T, A, R> Gatherer.ofSequential(Supplier<A> initializer, Gatherer.Integrator<A, T, R> integrator) Returns a new, sequential,Gathererdescribed by the giveninitializerandintegrator.static <T,A, R> Gatherer <T, A, R> Gatherer.ofSequential(Supplier<A> initializer, Gatherer.Integrator<A, T, R> integrator, BiConsumer<A, Gatherer.Downstream<? super R>> finisher) Returns a new, sequential,Gathererdescribed by the giveninitializer,integrator, andfinisher.static <T,R> Gatherer <T, ?, R> Gatherers.scan(Supplier<R> initial, BiFunction<? super R, ? super T, ? extends R> scanner) Returns a Gatherer that performs a Prefix Scan -- an incremental accumulation -- using the provided functions.static <T> Stream<T> StreamSupport.stream(Supplier<? extends Spliterator<T>> supplier, int characteristics, boolean parallel) Creates a new sequential or parallelStreamfrom aSupplierofSpliterator.static <T, C extends Collection<T>>
Collector<T, ?, C> Collectors.toCollection(Supplier<C> collectionFactory) Returns aCollectorthat accumulates the input elements into a newCollection, in encounter order.static <T, K, U, M extends ConcurrentMap<K,U>>
Collector<T, ?, M> Collectors.toConcurrentMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends U> valueMapper, BinaryOperator<U> mergeFunction, Supplier<M> mapFactory) Returns a concurrentCollectorthat accumulates elements into aConcurrentMapwhose keys and values are the result of applying the provided mapping functions to the input elements.Collectors.toMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends U> valueMapper, BinaryOperator<U> mergeFunction, Supplier<M> mapFactory) Returns aCollectorthat accumulates elements into aMapwhose keys and values are the result of applying the provided mapping functions to the input elements. -
Uses of Supplier in jdk.dynalink.linker
Classes in jdk.dynalink.linker that implement SupplierModifier and TypeClassDescriptionclassA class acting as a supplier of guarding dynamic linkers that can be automatically loaded by other language runtimes.Methods in jdk.dynalink.linker with parameters of type SupplierModifier and TypeMethodDescriptionGuardingTypeConverterFactory.convertToType(Class<?> sourceType, Class<?> targetType, Supplier<MethodHandles.Lookup> lookupSupplier) Returns a guarded type conversion that receives a value of the specified source type and returns a value converted to the specified target type.<T> TLinkerServices.getWithLookup(Supplier<T> operation, SecureLookupSupplier lookupSupplier) Executes an operation within the context of a particularMethodHandles.Lookuplookup object. -
Uses of Supplier in jdk.jshell
Methods in jdk.jshell with parameters of type SupplierModifier and TypeMethodDescriptionJShell.Builder.tempVariableNameGenerator(Supplier<String> generator) Sets a generator of temp variable names forVarSnippetofSnippet.SubKind.TEMP_VAR_EXPRESSION_SUBKIND.