Prepend an element to each list in a list
Let's say we have the following base list:
[["foo"],["bar"]]
and the input string "a"
I want to prepend the input string to each list in the list, which results in:
[["a", "foo"], ["a", "bar"]]
The Javascript equivalent would be:
const base = [["foo"], ["bar"]]
const prefix = "a"
const prefixedBase = base.map(it => [prefix, ...it])
How can this be achieved using a similar idiomatic format with Java streams?