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.
It is because you have used i+2 in str.substring(i, i+2), which causes the out of bound exception.