/// <summary>Returns a list of all modes in the Collection.</summary> /// <remarks> /// Returns a list of all modes in the Collection. (If the Collection has multiple items with the /// highest frequency, all of them will be returned.) /// </remarks> public static ICollection <T> Modes <T>(ICollection <T> values) { ICounter <T> counter = new ClassicCounter <T>(values); IList <double> sortedCounts = Edu.Stanford.Nlp.Util.CollectionUtils.Sorted(counter.Values()); double highestCount = sortedCounts[sortedCounts.Count - 1]; Counters.RetainAbove(counter, highestCount); return(counter.KeySet()); }