public List <String> getWordList() { List <String> words = new List <String>(); CountMap rfreeMap = new CountMap(); CountMap lfreeMap = new CountMap(); foreach (String str in countMap.Keys) { String head = str.Substring(0, str.Length - 1); String tail = str.Substring(1, str.Length - 1); rfreeMap.add(head); lfreeMap.add(tail); } foreach (String str in countMap.Keys) { if (rfreeMap.ContainsKey(str) && lfreeMap.ContainsKey(str)) { if (rfreeMap[str] >= 2 && lfreeMap[str] >= 2) { words.Add(lfreeMap[str] + "(" + str + ")" + rfreeMap[str]); } } } return(words); }
public static List <Idol> GetMyIdols() { return(Idols .Where(i => CountMap.ContainsKey(i.Id)) .SelectMany(i => Enumerable.Repeat(i, CountMap[i.Id])).ToList()); }