Skip to content

Commit 2c1e6cd

Browse files
committed
Replace deprecated flatMap() with compactMap()
1 parent 7cd10e7 commit 2c1e6cd

File tree

1 file changed

+1
-1
lines changed
  • Classic Computer Science Problems in Swift.playground/Pages/Chapter 8.xcplaygroundpage

1 file changed

+1
-1
lines changed

Classic Computer Science Problems in Swift.playground/Pages/Chapter 8.xcplaygroundpage/Contents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ let phoneMapping: [Character: [Character]] = ["1": ["1"], "2": ["a", "b", "c"],
151151

152152
// return all of the possible characters combos, given a mapping, for a given number
153153
func stringToPossibilities(_ s: String, mapping: [Character: [Character]]) -> [[Character]]{
154-
let possibilities = s.flatMap{ mapping[$0] }
154+
let possibilities = s.compactMap{ mapping[$0] }
155155
print(possibilities)
156156
return combineAllPossibilities(possibilities)
157157
}

0 commit comments

Comments
 (0)