public Iterator getBshIterator(Object obj) throws IllegalArgumentException {
		if (obj == null)
			throw new NullPointerException("Cannot iterate over null.");

		if (obj instanceof Enumeration) {
			final Enumeration enumeration = (Enumeration) obj;
			return new Iterator<Object>() {
				public boolean hasNext() {
					return enumeration.hasMoreElements();
				}

				public Object next() {
					return enumeration.nextElement();
				}

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

		if (obj instanceof Iterator)
			return (Iterator) obj;

		if (obj instanceof Iterable)
			return ((Iterable) obj).iterator();

		if (obj.getClass().isArray()) {
			final Object array = obj;
			return new Iterator() {
				private int index = 0;
				private final int length = Array.getLength(array);

				public boolean hasNext() {
					return index < length;
				}

				public Object next() {
					return Array.get(array, index++);
				}

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

		if (obj instanceof CharSequence)
			return getBshIterator(obj.toString().toCharArray());

		throw new IllegalArgumentException("Cannot iterate over object of type " + obj.getClass());
	}