{
return split((String) value, delimiter).iterator();
}
else
{
return new SingletonIterator(value);
}
}
else if (value instanceof Collection)
{
return toIterator(((Collection) value).iterator(), delimiter);
}
else if (value.getClass().isArray())
{
return toIterator(IteratorUtils.arrayIterator(value), delimiter);
}
else if (value instanceof Iterator)
{
Iterator iterator = (Iterator) value;
IteratorChain chain = new IteratorChain();
while (iterator.hasNext())
{
chain.addIterator(toIterator(iterator.next(), delimiter));
}
return chain;
}
else
{
return new SingletonIterator(value);
}
}