public static <T> Iterator<T> iterator(Class<T> class1, final Object value) { if (value == null) { return Collections.EMPTY_LIST.iterator(); } if (Boon.isArray(value)) { final int length = Arry.len(value); return new Iterator<T>() { int i = 0; @Override public boolean hasNext() { return i < length; } @Override public T next() { if (i >= length) throw new NoSuchElementException("No more properties"); T next = (T) BeanUtils.idx(value, i); i++; return next; } @Override public void remove() {} }; } else if (Typ.isCollection(value.getClass())) { return ((Collection<T>) value).iterator(); } else { return (Iterator<T>) Collections.singleton(value).iterator(); } }