Gets the result of {@code supplier}, or re-throws an exception, sneakily.

@param supplier the supplier
@param <T> the result type
@param <E> the exception type
@return the result
551618
public static <T, E extends Throwable> @NonNull T getOrRethrow(final @NonNull ThrowingSupplier<T, E> supplier) {
    return supplier.get(); // get() rethrows for us
  }
795485
public static <T> Supplier<T> once(final Supplier<T> function) {
        return new Supplier<T>() {
            private volatile boolean executed;
            private T result;
            @Override
            public T get() {
                if (!executed) {
                    executed = true;
                    result = function.get();
                }
                return result;
            }
        };
    }
142281
@Override
    public StreamT<W,T> onEmptyGet(final Supplier<? extends T> supplier) {

        return (StreamT<W,T>) FoldableTransformerSeq.super.onEmptyGet(supplier);
    }
585062
public <V> V computeIfAbsent(Key<V> key, Supplier<V> supplier) {
    V value = get(key);
    if (value != null) {
      return value;
    } else if (canStore(key)) {
      entries.put(key, RECURSION_SENTINEL);
      value = supplier.get();
      entries.put(key, requireNonNull(value));
      return value;
    } else if (parent != null) {
      return parent.computeIfAbsent(key, supplier);
    } else {
      throw new IllegalStateException(
          "Not in " + key.level().toString().toLowerCase() + " scope");
    }
  }
967254
@Override
	public <E extends Exception> List<T> getPluginsFor(S delimiter, Supplier<E> ex) throws E {

		Assert.notNull(delimiter, "Delimiter must not be null!");
		Assert.notNull(ex, "Exception supplier must not be null!");

		List<T> result = getPluginsFor(delimiter);

		if (result.isEmpty()) {
			throw ex.get();
		}

		return result;
	}
713130
public static <E extends Exception> void possible(double possible, Supplier<E> exceptionFactory) throws E {
    if (Math.random() < possible) {
      throw exceptionFactory.get();
    }
  }
126338
@SuppressWarnings("unchecked")
    public static <T> Randomizer<T> asRandomizer(final Supplier<T> supplier) {

        class RandomizerProxy implements InvocationHandler {

            private final Supplier<?> target;

            private RandomizerProxy(final Supplier<?> target) {
                this.target = target;
            }

            @Override
            public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
                if ("getRandomValue".equals(method.getName())) {
                    Method getMethod = target.getClass().getMethod("get");
                    getMethod.setAccessible(true);
                    return getMethod.invoke(target);
                }
                return null;
            }
        }

        return (Randomizer<T>) Proxy.newProxyInstance(
                Randomizer.class.getClassLoader(),
                new Class[]{Randomizer.class},
                new RandomizerProxy(supplier));
    }
793679
public static <E, T, X extends RuntimeException> List<E> convertBeans(List<T> source, Class<E> targetClass,
            Supplier<X> exceptionSupplier, boolean nonNullFilter) {
        return convertBeans(source, targetClass, exceptionSupplier, false, nonNullFilter);
    }
38489
public static IntIterator generate(final IntSupplier supplier) {
        N.checkArgNotNull(supplier);

        return new IntIterator() {
            @Override
            public boolean hasNext() {
                return true;
            }

            @Override
            public int nextInt() {
                return supplier.getAsInt();
            }
        };
    }
308023
public static <R> Supplier<R> call(Object target, Method method, Object... parameters) {
        return new MethodSupplier<R>(target, method, parameters);
    }
1084770
public static <T, U, X extends RuntimeException> U convertBean(T source, Class<U> targetClass,
            Supplier<X> exceptionSupplier) {
        Objects.requireNonNull(targetClass,"TargetClass can not be null");
        if (Objects.isNull(source)) {
            return SupplierUtil.ifNonNullThrowOrElse(exceptionSupplier, () -> null);
        }
        Handler handler = ConverterContext.getActionHandler(source.getClass(), targetClass);
        log.info("Call method \"{}\"", handler.getMethod());
        try {
            return targetClass.cast(handler.getMethod().invoke(handler.getHandler(), source));
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw ConvertException.of("Call method \"" + handler.getMethod() + "\" failed", e);
        }
    }
1190364
@SuppressWarnings("unchecked")
   public static <T, R> SerializableSupplier<Collector<T, ?, R>> toSerialSupplierCollect(
      SerializableSupplier supplier) {
      return supplier;
   }
802220
public static <T> Supplier<T> supplier(CheckedSupplier<T> supplier) {
        return Unchecked.supplier(supplier, Unchecked.RETHROW_ALL);
    }
209436
@SuppressWarnings("unchecked")
	@Override
	public T param(final String paramName, final Supplier<Object> supplier) {
		context().param(paramName, supplier);
		return (T) this;
	}
1254520
public static <T> Supplier<Optional<T>> supplier(Iterator<T> adaptee) {
        return new IteratingSupplier<T>(adaptee);
    }
135076
public static <T> Lazy<T> get(Supplier<? extends T> supplier) {
        return new SuppliedLazy<T>(supplier);
    }
506599
ExecutionResult executeSync(Supplier<ExecutionResult> supplier) {
    for (PolicyExecutor<Policy<Object>> policyExecutor : policyExecutors)
      supplier = policyExecutor.supply(supplier);

    ExecutionResult result = supplier.get();
    completed = result.isComplete();
    executor.handleComplete(result, this);
    return result;
  }