Valid Scala syntax is
ab.toCharArray.map(x => if ("aeiou".indexOf(x) >= 0) x else ' ')
On contrary
ab.chars().map(x -> "aeiou".indexOf(x) >= 0 ? x : ' ');
is Java syntax.
1
solved scala how to mimic a ternary operator in anonymous functions
Valid Scala syntax is
ab.toCharArray.map(x => if ("aeiou".indexOf(x) >= 0) x else ' ')
On contrary
ab.chars().map(x -> "aeiou".indexOf(x) >= 0 ? x : ' ');
is Java syntax.
1
solved scala how to mimic a ternary operator in anonymous functions