Converts given array to an {@link Iterable}

@param obj an array
@return an Iterable that iterates over the entries of an array
11023
@SuppressWarnings("unchecked")
    public Iterable<?> toIterable(Object obj) {
        if (isArray(obj))
            return ((Iterable) obj);
        else
            throw new JsonPathException("Cannot iterate over " + obj!=null?obj.getClass().getName():"null");
    }
1014948
public static function toArray(object $obj)
    {
        $array = (array)get_object_vars($obj);
        foreach ($array as $key => &$value) {
            if (is_object($value) && method_exists($value, 'toArray')) {
                $array[$key] = $value->toArray();
            } else if (is_array($value)) {
                foreach ($value as $deeper => $deepValue) {
                    if (is_object($deepValue) && method_exists($deepValue, 'toArray')) {
                        $value[$deeper] = $deepValue->toArray();
                    }
                }
            }
        }

        return $array;
    }
738831
public <A extends Appendable> A appendTo(A appendable, Iterable<? extends Entry<?, ? extends Collection<?>>> entries)
			throws IOException {
		//    checkNotNull(appendable);
		Iterator<? extends Entry<?, ? extends Collection<?>>> iterator = entries.iterator();
		if (iterator.hasNext()) {
			Entry<?, ? extends Collection<?>> entry = iterator.next();
			appendable.append(toString(entry.getKey()));
			appendable.append(keyValueSeparator);
			entryJoiner.appendTo(appendable, entry.getValue());
			while (iterator.hasNext()) {
				appendable.append(separator);
				Entry<?, ? extends Collection<?>> e = iterator.next();
				appendable.append(toString(e.getKey()));
				appendable.append(keyValueSeparator);
				entryJoiner.appendTo(appendable, e.getValue());
			}
		}
		return appendable;
	}
1070622
public Object[] toArray() {
    Iterator<E> iter = iterator();
    ArrayList<Object> al = new ArrayList<Object>();
    while (iter.hasNext()) {
      al.add(iter.next());
    }
    return al.toArray();
  }
766046
public Iterable<Tuple2<String, Obj>> asKeyObjSeq(final @Nullable Obj obj) {
		return new Iterable<Tuple2<String, Obj>>() {
			@Override public Iterator<Tuple2<String, Obj>> iterator() {
				if (obj != null) {
					final Iterator<Entry<String, Object>> i = obj.iterator();
					return new Iterator<Tuple2<String, Obj>>() {
						@Override public boolean hasNext() {
							return i.hasNext();
						}
						@Override public Tuple2<String, Obj> next() {
							Entry<String, Object> entry = i.next();
							return new Tuple2<String, Obj>(entry.getKey(), (Obj) entry.getValue());
						}
						@Override public void remove() {
							Check.unsupportedoperation.fail();
						}
					};
				}
				return java.util.Collections.emptyIterator();
			}
		};
	}
254520
function forEach(obj, fn) {
  // Don't bother if no value provided
  if (obj === null || typeof obj === 'undefined') {
    return;
  }

  // Force an array if not already something iterable
  if (typeof obj !== 'object') {
    /* eslint no-param-reassign:0 */
    obj = [obj];
  }

  if (Array.isArray(obj)) {
    // Iterate over array values
    for (let i = 0, l = obj.length; i < l; i += 1) {
      fn.call(null, obj[i], i, obj);
    }
  } else {
    // Iterate over object keys
    Object.entries(obj).forEach(([key, val]) => {
      fn.call(null, val, key, obj);
    });
  }
}
931527
function ( obj ) {
		var indexed = [];

		utility.iterate( obj, function ( v ) {
			indexed.push( v );
		});

		return indexed;
	}
766034
public static <T> Iterable<T> simpleIterable(final Iterable<T> iterable) {
        requireNonNull(iterable);
        return () -> iterable.iterator();
    }
452768
public Iterable<Map.Entry<Integer, Record>> entries() {
        return () -> new Iterator<Map.Entry<Integer, Record>>() {
            private final Iterator<Map.Entry<Integer, Record>> it = data.records.entrySet().iterator();

            /** {@inheritDoc} */
            @Override
            public boolean hasNext() {
                return it.hasNext();
            }

            /** {@inheritDoc} */
            @Override
            public Map.Entry<Integer, Record> next() {
                return it.next();
            }

            /** {@inheritDoc} */
            @Override
            public void remove() {
                throw new UnsupportedOperationException("This is a read-only iterator, remove operation is not supported.");
            }
        };
    }
566867
public static Iterable<Object> subIterable(Object iterable, int fromIndex) {
    if (iterable == null || getLength(iterable) < fromIndex)
      return Collections.emptyList();

    final Iterator<Object> iterator = iterator(iterable);
    for (int i = 0; i < fromIndex; i++)
      iterator.next();
    return new Iterable<Object>() {
      @Override
      public Iterator<Object> iterator() {
        return iterator;
      }
    };
  }
506536
public static JSON parse(Object obj) {
		if (null == obj) {
			return null;
		}

		JSON json = null;
		if (obj instanceof JSON) {
			json = (JSON) obj;
		} else if (obj instanceof String) {
			String jsonStr = ((String) obj).trim();
			if (jsonStr.startsWith("[")) {
				json = parseArray(jsonStr);
			} else {
				json = parseObj(jsonStr);
			}
		} else if (obj instanceof Collection || obj.getClass().isArray()) {// 列表
			json = new JSONArray(obj);
		} else {// 对象
			json = new JSONObject(obj);
		}

		return json;
	}
1184656
public static Object[] wrap(Object obj) {
		if (null == obj) {
			return null;
		}
		if (isArray(obj)) {
			try {
				return (Object[]) obj;
			} catch (Exception e) {
				final String className = obj.getClass().getComponentType().getName();
				switch (className) {
				case "long":
					return wrap((long[]) obj);
				case "int":
					return wrap((int[]) obj);
				case "short":
					return wrap((short[]) obj);
				case "char":
					return wrap((char[]) obj);
				case "byte":
					return wrap((byte[]) obj);
				case "boolean":
					return wrap((boolean[]) obj);
				case "float":
					return wrap((float[]) obj);
				case "double":
					return wrap((double[]) obj);
				default:
					throw new UtilException(e);
				}
			}
		}
		throw new UtilException(StrUtil.format("[{}] is not Array!", obj.getClass()));
	}
573555
def make_iterable(obj):
    
    if not obj:
        return tuple()

    if isinstance(obj, (list, tuple, set)):
        return obj

    return (obj,)
976058
def to_iter(obj):
    
    if isinstance(obj, type(None)):
        return None
    elif isinstance(obj, six.string_types):
        return [obj]
    else:
        # Nesting here since symmetry is broken in isinstance checks.
        # Strings are iterables in python 3, so the relative order of if statements is important.
        if isinstance(obj, collections.Iterable):
            return obj
        else:
            return [obj]
590107
public static Stream<Map.Entry<Method, Object>> getters(Object obj) {
		return getters(obj, Predicates.alwaysTrue());
	}
1253126
function to_array(obj) { var result, i
        result = []
        obj    = Object(obj)
        for (i = size(obj); i--;)
            if (i in obj)  result[i] = obj[i]

        return result
    }
325146
@SuppressWarnings({"unchecked", "unused"})
    public static <T> T[] object2Array(final Class<T> clazz, final Object obj) {
        return (T[]) obj;
    }