@SuppressWarnings({"unchecked", "rawtypes"})
    public static <T> T get(@Nullable final Iterable<T> iterable, final int idx) {
        if (iterable == null || idx < 0) {
            return null;
        }
        if (iterable instanceof Collection) {
            final int size = ((Collection) iterable).size();
            if (idx >= size) {
                return null;
            }
            if (iterable instanceof List) {
                return (T) ((List) iterable).get(idx);
            }
        }
        int i = 0;
        for (T element : iterable) {
            if (i == idx) {
                return element;
            }
            i++;
        }
        return null;
    }
retrieves the idx's element of the given iterable, or null if iterable doesn't have enough elements
main/src/main/java/cgeo/geocaching/utils/CommonUtils.java