public CitiesCollection(IEnumerable <City> cities, int minLen, int capacity = 1000) { _suffixdict = new SuffixDict <City>(minLen, capacity); foreach (var c in cities) { _suffixdict.Add(c.Name, c); } }
public CitiesCollection(IEnumerable <City> cities, int minLen) { _cities = cities.ToDictionary(c => c.Id); _suffixdict = new SuffixDict <int>(minLen, _cities.Values.Count); foreach (var c in _cities.Values) { _suffixdict.Add(c.Name, c.Id); } }
public CitiesCollection(IEnumerable <City> cities, int minLen, int capacity = 1000) { _suffixdict = new SuffixDict <City>(minLen, _comparer, capacity); _countries = new HashSet <string>(); _cities = new Dictionary <int, City>(capacity); foreach (var c in cities) { _suffixdict.Add(c.Name, c); _countries.Add(c.Country); _cities.Add(c.Id, c); } }