Issue #510
Use Dictionary(grouping:by:)
func groups(countries: [Country]) -> [Group] {
let dictionary = Dictionary(grouping: countries, by: { String($0.name.prefix(1)) })
let groups = dictionary
.map({ (key: String, value: [Country]) -> Group in
return Group(initial: key, countries: value)
})
.sorted(by: { $0.initial < $1.initial })
return groups
}