return list.iterator();
} else if ( value instanceof Map ) {
Map map = (Map) value;
return map.entrySet().iterator();
} else if ( value.getClass().isArray() ) {
return new ArrayIterator( value );
} else if ( value instanceof Enumeration ) {
return new EnumerationIterator((Enumeration ) value);
} else if ( value instanceof Collection ) {
Collection collection = (Collection) value;
return collection.iterator();
} else if ( value instanceof String ) {
String[] array = StringUtils.split((String) value, "," );
array = StringUtils.stripAll( array );
return new ArrayIterator( array );
} else {
// XXX: should we return single iterator?
return new SingletonIterator( value );
}
}