public void addFacetCount(BytesRef facetValue, int count) {if (count < currentMin) {return;}FacetEntry facetEntry = new FacetEntry(facetValue, count);if (facetEntries.size() == maxSize) {if (facetEntries.higher(facetEntry) == null) {return;}facetEntries.pollLast();}facetEntries.add(facetEntry);if (facetEntries.size() == maxSize) {currentMin = facetEntries.last().count;}}
public virtual void AddFacetCount(BytesRef facetValue, int count){if (count < currentMin){return;}FacetEntry facetEntry = new FacetEntry(facetValue, count);if (facetEntries.Count == maxSize){if (!facetEntries.TryGetSuccessor(facetEntry, out FacetEntry _)){return;}var max = facetEntries.Max;if (max != null)facetEntries.Remove(max);}facetEntries.Add(facetEntry);if (facetEntries.Count == maxSize){var max = facetEntries.Max;currentMin =  max != null ? max.Count : 0;}}