Creates a new {@link Iterable} by concatenating two iterables.
977126
public static <E> Iterable<E> concat(Iterable<E> a, Iterable<E> b) {
    List<E> result = new ArrayList<>();
    for (E e : a) {
      result.add(e);
    }
    for (E e : b) {
      result.add(e);
    }

    return result;
  }
1190661
public static <T, R> Iterable<R> map(final Iterable<T> iterable, final IFunction<T, R> mapper) {
        return new Iterable<R>() {
            @Override
            public Iterator<R> iterator() {
                return map(iterable.iterator(), mapper);
            }
        };
    }
627103
public static BasicTagList concat(TagList t1, TagList t2) {
    return new BasicTagList(Iterables.concat(t1, t2));
  }
814397
public final <T4, T5> Tuple5<T1, T2, T3, T4, T5> concat(Tuple2<T4, T5> tuple) {
        return new Tuple5<>(v1, v2, v3, tuple.v1, tuple.v2);
    }
726264
public static <T> Iterable<T> iterable(T first, T second) {
        return ArrayIterable.of(first, second);
    }
94140
@SafeVarargs
    public static <T> Iterable<T> sequence( final Iterable<? extends T>... iterables ) {
        return new Iterable<T>() {
            public Iterator<T> iterator() {
                return new FlattenIterator<T,Iterable<? extends T>>(ImmutableList.copyOf(iterables)) {
                    protected Iterator<T> expand(Iterable<? extends T> iterable) {
                        return Iterators.<T>cast(iterable).iterator();
                    }
                };
            }
        };
    }
1129119
public static Mapper concat(final Mapper first, final Mapper second){
        return new ConcatMapper(new Mapper[]{first,second});
    }
429752
@Override
    public <R> Future<R> concatMap(final Function<? super T, ? extends Iterable<? extends R>> mapper) {
        return (Future<R>) MonadicValue.super.concatMap(mapper);
    }
947864
public static <E> Iterable<E> asIterable(final Iterator<E> iter) {
		return new Iterable<E>() {
			@Override
			public Iterator<E> iterator() {
				return iter;
			}
		};
	}
889662
public static <R> Stream<R> of(Iterable<R> iterable) {
        return new Stream<R>(iterable.iterator());
    }
283339
public static <T> CloseableIterable<T> concat(final CloseableIterable<? extends Iterable<? extends T>> inputs) {
        return wrap(Iterables.concat(inputs), inputs);
    }
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;
    }
833364
public static <T> CloseableIterable<T> fromIterable(Iterable<T> iterable) {
        requireNonNull(iterable);
        if (iterable instanceof CloseableIterable) return (CloseableIterable<T>) iterable;

        return new FluentCloseableIterable<T>() {
            @Override
            protected void doClose() {
                if (iterable instanceof AutoCloseable) {
                    try {
                        ((AutoCloseable) iterable).close();
                    } catch (RuntimeException re) {
                        throw re;
                    } catch (Exception e) {
                        throw new IllegalStateException(e);
                    }
                }
            }

            @Override
            protected Iterator<T> retrieveIterator() {
                return iterable.iterator();
            }
        };
    }
488731
@SuppressWarnings("unchecked")
    public static <E> E[] toArray(final Iterable<E> iterable) {
        return (E[]) newArrayList(iterable).toArray();
    }
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();
    }
246031
public int addAll(Iterable<? extends KTypeCursor<? extends KType>> iterable) {
    int size = 0;
    for (KTypeCursor<? extends KType> cursor : iterable) {
      add(cursor.value);
      size++;
    }
    return size;
  }
978648
public static <T> Iterable<T> unmodifiableIterable(
      final Iterable<T> iterable) {
    checkNotNull(iterable);
    if (iterable instanceof UnmodifiableIterable ||
        iterable instanceof ImmutableCollection) {
      return iterable;
    }
    return new UnmodifiableIterable<T>(iterable);
  }