public static <T> Supplier<T> supplierOf(final T... values) {
    final AtomicInteger index = new AtomicInteger(0);
    return new Supplier<T>() {
      @Override
      public T get() {
        if (index.get() < values.length) {
          return values[index.getAndIncrement()];
        } else {
          return values[values.length - 1];
        }
      }
    };
  }
Creates a supplier of T.

@param values values to return on {@code get()}
@return supplier of T
drawee/src/test/java/com/facebook/drawee/testing/DraweeMocks.java