// this code is optimized to only use a Scanner if needed, eg there is a delimiter
if (delimiter != null && s.contains(delimiter)) {
// use a scanner if it contains the delimiter
Scanner scanner = new Scanner((String)value);
scanner.useDelimiter(delimiter);
return CastUtils.cast(scanner);
} else {
// use a plain iterator that returns the value as is as there are only a single value
return CastUtils.cast(new Iterator<String>() {
int idx = -1;