public QueryTermScorer(WeightedTerm[] weightedTerms) {termsToFind = new HashMap<>();for (int i = 0; i < weightedTerms.length; i++) {WeightedTerm existingTerm = termsToFind.get(weightedTerms[i].term);if ((existingTerm == null)|| (existingTerm.weight < weightedTerms[i].weight)) {termsToFind.put(weightedTerms[i].term, weightedTerms[i]);maxTermWeight = Math.max(maxTermWeight, weightedTerms[i].getWeight());}}}

public QueryTermScorer(WeightedTerm[] weightedTerms){termsToFind = new Dictionary<string, WeightedTerm>();for (int i = 0; i < weightedTerms.Length; i++){if (!termsToFind.TryGetValue(weightedTerms[i].Term, out WeightedTerm existingTerm)|| (existingTerm == null)|| (existingTerm.Weight < weightedTerms[i].Weight)){termsToFind[weightedTerms[i].Term] = weightedTerms[i];maxTermWeight = Math.Max(maxTermWeight, weightedTerms[i].Weight);}}}
