class Guavate {

  @SuppressWarnings("unchecked")
  @SafeVarargs
  public static <T> Optional<T> firstNonEmpty(Supplier<Optional<? extends T>>... suppliers) {
    for (Supplier<Optional<? extends T>> supplier : suppliers) {
      Optional<? extends T> result = supplier.get();
      if (result.isPresent()) {
        // safe, because Optional is read-only
        return (Optional<T>) result;
      }
    }
    return Optional.empty();
  }

  private  Guavate();

}