Question: `Iterable` has a `forEach` default method

<https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html>

Why does it not have a `map` method? 

For example, `Map` has a `map` method.

Answer: 
Think about this part:

```
str.substring(i, i+2)

```

When `i` is equal to the length of the string, `i + 2` will overshoot the end of the string by 1, giving you an out of bounds error.
When you use `str.length()` it gives you the length of the string, while the max index of string that is accessible is given by `str.length() - 1`. For example, `"String"` will have length of 6. So, when you try to do this `str.substring(5 , (5+ 2))` it will try to access the index which is out of the bound and hence it throw the exception.