Returns a fluent iterable that wraps {@code iterable}, or {@code iterable} itself if it
is already a {@code FluentIterable}.
775612
public static <E> FluentIterableWrapper<E> from(final Iterable<E> iterable) {
        return (iterable instanceof FluentIterableWrapper)
                ? (FluentIterableWrapper<E>) iterable
                : new FluentIterableWrapper<E>(iterable) { };
    }
321202
public static function toIterable($iterable): iterable
    {
        if (is_iterable($iterable)) {
            return $iterable;
        }

        if (is_object($iterable)) {
            return get_object_vars($iterable);
        }

        return (array) $iterable;
    }
916496
@SuppressWarnings("unchecked")
    protected Iterable _transform(final Iterable iterable) {
        if (iterable == null) return null;
        if (iterable instanceof BeanIterable) return iterable;
        return new BeanIterable<>(iterable, this);
    }
789024
public static <T> LazyIterable<T> distinct(Iterable<T> iterable)
    {
        return new DistinctIterable<T>(iterable);
    }
1198477
public static <E> Collection<E> iterable2coll(final Iterable<E> itrbl) {
	return new AbstractCollection<E>() {
	    public Iterator<E> iterator() {
		return itrbl.iterator();
	    }
	    public int size() {
		return DSUtil.iterableSize(itrbl);
	    }
	};
    }
626300
public static <E> Iterable<E> unmodifiableIterable(final Iterable<E> itrbl) {
	return new Iterable<E>() {
	    public Iterator<E> iterator() {
		return DSUtil.<E>unmodifiableIterator(itrbl.iterator());
	    }
	};
    }
701365
public static <T> Iterable<T> cast(Iterable<?> iterable) {
    return iterable == null ? null : new CastingIterable<T>(iterable);
  }
191344
public static <T> LazyIterable<T> concatenate(Iterable<T>... iterables)
    {
        return CompositeIterable.with(iterables);
    }
441307
public static <T, V> LazyIterable<V> collect(
            Iterable<T> iterable,
            Function<? super T, ? extends V> function)
    {
        return new CollectIterable<T, V>(iterable, function);
    }
1059214
public static <T> LazyIterable<T> take(Iterable<T> iterable, int count)
    {
        return new TakeIterable<T>(iterable, count);
    }
465462
public static <T> Iterator<T> iteratorOverIterables(
        Iterable<? extends T> iterable0, Iterable<? extends T> iterable1)
    {
        Objects.requireNonNull(iterable0, "The iterable0 is null");
        Objects.requireNonNull(iterable1, "The iterable1 is null");
        List<Iterable<? extends T>> iterables =
            new ArrayList<Iterable<? extends T>>(2);
        iterables.add(iterable0);
        iterables.add(iterable1);
        return iteratorOverIterables(iterables.iterator());
    }
744785
public SerIterable createIterable(SerIterable iterable) {
        List<Class<?>> valueTypeTypes = iterable.valueTypeTypes();
        if (valueTypeTypes.size() > 0) {
            Class<?> valueType = iterable.valueType();
            if (NavigableSet.class.isAssignableFrom(valueType)) {
                return navigableSet(valueTypeTypes.get(0), EMPTY_VALUE_TYPES);
            }
            if (SortedSet.class.isAssignableFrom(valueType)) {
                return sortedSet(valueTypeTypes.get(0), EMPTY_VALUE_TYPES);
            }
            if (Set.class.isAssignableFrom(valueType)) {
                return set(valueTypeTypes.get(0), EMPTY_VALUE_TYPES);
            }
            if (Collection.class.isAssignableFrom(valueType)) {  // includes List
                return list(valueTypeTypes.get(0), EMPTY_VALUE_TYPES);
            }
            if (NavigableMap.class.isAssignableFrom(valueType)) {
                if (valueTypeTypes.size() == 2) {
                    return navigableMap(valueTypeTypes.get(0), valueTypeTypes.get(1), EMPTY_VALUE_TYPES);
                }
                return navigableMap(Object.class, Object.class, EMPTY_VALUE_TYPES);
            }
            if (SortedMap.class.isAssignableFrom(valueType)) {
                if (valueTypeTypes.size() == 2) {
                    return sortedMap(valueTypeTypes.get(0), valueTypeTypes.get(1), EMPTY_VALUE_TYPES);
                }
                return sortedMap(Object.class, Object.class, EMPTY_VALUE_TYPES);
            }
            if (Map.class.isAssignableFrom(valueType)) {
                if (valueTypeTypes.size() == 2) {
                    return map(valueTypeTypes.get(0), valueTypeTypes.get(1), EMPTY_VALUE_TYPES);
                }
                return map(Object.class, Object.class, EMPTY_VALUE_TYPES);
            }
            if (valueType.isArray()) {
                if (valueType.getComponentType().isPrimitive()) {
                    return arrayPrimitive(valueType.getComponentType());
                } else {
                    return array(valueType.getComponentType());
                }
            }
        }
        return null;
    }
309713
public static <T> Predicate<Iterable<T>> anyPredicate(final Predicate<T> pred) {
    return new Predicate<Iterable<T>>() {
      @Override
      public boolean apply(final Iterable<T> iter) {
        return com.google.common.collect.Iterables.any(iter, pred);
      }
    };
  }
1196992
static Iterator<MutableIntTuple> wrappingIterator(
        IntTuple bounds, Iterator<? extends MutableIntTuple> delegate)
    {
        return wrappingIteratorInternal(IntTuples.copy(bounds), delegate);
    }
910555
@Beta
  public static <E> FluentIterable<E> of(E[] elements) {
    return from(Lists.newArrayList(elements));
  }
1161265
public static <T> Set<T> iterableToSet(Iterable<T> iterable) {
        if (iterable == null) {
            return Collections.emptySet();
        }
        if (iterable instanceof Set) {
            return (Set<T>) iterable;
        }
        Iterator<T> i = iterable.iterator();
        if (i.hasNext()) {
            Set<T> list = new HashSet<>();
            while (i.hasNext()) {
                list.add(i.next());
            }
            return list;
        }
        return Collections.emptySet();
    }
139420
public static <T> Stream<T> of(Iterable<T> iterable) {
    checkNotNull(iterable);
    return new StreamImpl<T>(iterable);
  }