Class SneakySupplier<T>

java.lang.Object
com.github.twitch4j.common.util.SneakySupplier<T>
Type Parameters:
T - the return type of values provided by the supplier
All Implemented Interfaces:
Supplier<T>

public final class SneakySupplier<T> extends Object implements Supplier<T>
A supplier that can sneakily throw exceptions.

This class should be used sparingly (to avoid hackiness) and carefully (to ensure bubbled exceptions are properly handled).

  • Constructor Details

    • SneakySupplier

      public SneakySupplier(@NotNull @NotNull Callable<T> callable)
      Creates a new SneakySupplier instance.
      Parameters:
      callable - The action to compute the supplied value, possibly throwing an exception.
  • Method Details

    • get

      public T get()
      Specified by:
      get in interface Supplier<T>