/** * Construct a new FluentIterable from the provided iterable. If the * iterable is already an instance of FluentIterable, the instance * will be returned instead. * <p> * The returned iterable's iterator supports {@code remove()} when the * corresponding input iterator supports it. * * @param <T> the element type * @param iterable the iterable to wrap into a FluentIterable, may not be null * @return a new FluentIterable wrapping the provided iterable * @throws NullPointerException if iterable is null */ public static <T> FluentIterable<T> of(final Iterable<T> iterable) { IterableUtils.checkNotNull(iterable); if (iterable instanceof FluentIterable<?>) { return (FluentIterable<T>) iterable; } return new FluentIterable<>(iterable); }