Return a List containing all the elements of the specified Iterable that compare as being
equal to the minimum element.

@throws NoSuchElementException if the Iterable is empty.
775214
public static <T> List<T> minList (Iterable<T> iterable, Comparator<? super T> comp)
    {
        return maxList(iterable, java.util.Collections.reverseOrder(comp));
    }
650219
def max_len(iterable, minimum=0):
    
    try:
        result = max(map(len, iterable))
    except ValueError:
        result = minimum
    return minimum if result < minimum else result
314579
public static <T> List<T> toList(Iterable<T> iterable)
    {
        Objects.requireNonNull(iterable, "The iterable is null");
        return Iterables.toCollection(iterable, new ArrayList<T>());
    }
461086
public static <T> Iterable<T> toIterable(Enumeration<T> in) {
        List<T> out = new LinkedList<T>();
        while(in.hasMoreElements()) {
            out.add(in.nextElement());
        }
        return out;
    }
1003784
def _all_equal(iterable):
    """"""
    iterator = iter(iterable)
    first = next(iterator)
    return all(first == rest for rest in iterator)
59975
public static Iterator iterator(Object list)
    {
        if (list==null)
            return Collections.EMPTY_LIST.iterator();
        if (list instanceof List)
            return ((List)list).iterator();
        return getList(list).iterator();
    }
1255003
public static <T> Iterable<T> nullSafeIterable(T[] iterable) {
        return (iterable != null) ? Arrays.asList(iterable) : Collections.EMPTY_LIST;
    }
586877
public static <E extends Comparable<E>> E minimum(Iterator<E> iterator, E init) {
        return Reductions.reduce(iterator, BinaryOperator.minBy(new ComparableComparator<E>()), init);
    }
602833
public E get(final int index) {
        final int sz = size();
        if (index < 0 || index >= sz) {
            throw new NoSuchElementException(
                String.format("The specified index (%1$d) is outside the available range [0, %2$d)",
                    Integer.valueOf(index), Integer.valueOf(sz)));
        }

        final int idx = (start + index) % maxElements;
        return elements[idx];
    }
59409
private List<Integer> getEqualToUsedOnlyInEquivalentElements(List<Integer> equalTo, List<Integer> equivalentElements) {
        List<Integer> result = new ArrayList<>(equalTo);
        for (int i = 0; i < equalElements.size(); i++) {
            if (!alreadyMatched.get(i)) {
                if (!equivalentElements.contains(i)) {
                    result.removeAll(equalElements.get(i));
                }
            }
        }
        return result;
    }
502389
public static <T> Iterator<T> checkHasNext(Iterator<T> iterator, String message) throws NoSuchElementException {
        if (!iterator.hasNext()) {
            throw new NoSuchElementException(message);
        }
        return iterator;
    }
927985
def element_at(self, n):
        
        result = list(itertools.islice(self.to_list(), max(0, n), n + 1, 1))
        if len(result) == 0:
            raise NoElementsError(u"No element found at index {0}".format(n))
        return result[0]
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);
  }
797744
public IntSet.IntIterator iterator()
  {
    if (isEmpty()) {
      return new IntSet.IntIterator()
      {
        @Override
        public void skipAllBefore(int element) {/*empty*/}

        @Override
        public boolean hasNext() {return false;}

        @Override
        public int next() {throw new NoSuchElementException();}

        @Override
        public void remove() {throw new UnsupportedOperationException();}

        @Override
        public IntSet.IntIterator clone() {throw new UnsupportedOperationException();}
      };
    }
    return new BitIterator();
  }
1150815
public T min() {
        TObjectDoubleIterator<T> iter = counts.iterator();
        double minCount = Double.MAX_VALUE;
        T min = null;
        while (iter.hasNext()) {
            iter.advance();
            double count = iter.value();
            if (count < minCount) {
                min = iter.key();
                minCount = count;
            }
        }
        return min;
    }
834073
public static <T> List<T> maxList (Iterable<T> iterable, Comparator<? super T> comp)
    {
        Iterator<T> itr = iterable.iterator();
        T max = itr.next();
        List<T> maxes = new ArrayList<T>();
        maxes.add(max);
        if (itr.hasNext()) {
            do {
                T elem = itr.next();
                int cmp = comp.compare(max, elem);
                if (cmp <= 0) {
                    if (cmp < 0) {
                        max = elem;
                        maxes.clear();
                    }
                    maxes.add(elem);
                }
            } while (itr.hasNext());

        } else if (0 != comp.compare(max, max)) {
            // The main point of this test is to compare the sole element to something,
            // in case it turns out to be incompatible with the Comparator for some reason.
            // In that case, we don't even get to this IAE, we've probably already bombed out
            // with an NPE or CCE. For example, the Comparable version could be called with
            // a sole element of null. (Collections.max() gets this wrong.)
            throw new IllegalArgumentException();
        }
        return maxes;
    }
368760
public static <T> T last(Iterable<T> iterable) {
		if (iterable instanceof List<?>) {
			List<T> list = (List<T>) iterable;
			if (list.isEmpty())
				return null;
			return list.get(list.size() - 1);
		} else if (iterable instanceof SortedSet) {
			SortedSet<T> sortedSet = (SortedSet<T>) iterable;
			if (sortedSet.isEmpty())
				return null;
			return sortedSet.last();
		} else {
			return IteratorExtensions.last(iterable.iterator());
		}
	}