Build count map map.

@param wordList the word list
@return the map
165600
public static Map<String, Long> buildCountMap(List<String> wordList) {
        return buildCountMap(wordList.stream());
    }
652061
public static <T> Map<T, Integer> countMap(Iterator<T> iter) {
		final HashMap<T, Integer> countMap = new HashMap<>();
		if (null != iter) {
			Integer count;
			T t;
			while (iter.hasNext()) {
				t = iter.next();
				count = countMap.get(t);
				if (null == count) {
					countMap.put(t, 1);
				} else {
					countMap.put(t, count + 1);
				}
			}
		}
		return countMap;
	}
948610
public WordNumberCollectorBundle addNumberList(String key,
            List<Number> numberList) {
        numberCollector.addAll(key, numberList);
        return this;
    }
943016
public static Map<Object, Map<Object, Double>>
			countCategoryCoincidence(final ICodingAnnotationItem item) {
		Map<Object, Map<Object, Double>> result =
				new HashMap<Object, Map<Object, Double>>();
		for (IAnnotationUnit unit1 : item.getUnits()) {
            for (IAnnotationUnit unit2 : item.getUnits()) {
				if (unit1 == unit2) {
                    continue;
                }

				Object category1 = unit1.getCategory();
				Object category2 = unit2.getCategory();
				if (category1 == null || category2 == null) {
                    continue;
                }

				Map<Object, Double> cat1 = result.get(category1);
				if (cat1 == null) {
					cat1 = new HashMap<Object, Double>();
					result.put(category1, cat1);
				}

				Double value = cat1.get(category2);
				if (value == null) {
                    cat1.put(category2, 1.0);
                }
                else {
                    cat1.put(category2, value + 1.0);
                }
			}
        }

		int raterCount = item.getRaterCount();
		for (Map<Object, Double> cat2 : result.values()) {
            for (Entry<Object, Double> entry : cat2.entrySet()) {
                cat2.put(entry.getKey(), entry.getValue() / (raterCount - 1));
            }
        }

		return result;
	}
512869
public static int[] mapToList(int[] bitMap) {
        int[] list = new int[(int)(bitMap.length * WORD_LENGTH)];
        Arrays.fill(list, 0);
        int j = -1;
        for (int i = 0; i < list.length; i++) {
            if (i % WORD_LENGTH == 0) {
                j++;
            }
            list[i] = (bitMap[j] & (1 << ((WORD_LENGTH - 1) - (i % WORD_LENGTH)))) == 0 ? 0 : 1;
        }
        return list;
    }
81715
public static Map<String, String> convertDirectedListToMap(final List<String> inputList) {
        val mappings = new TreeMap<String, String>();
        inputList
            .stream()
            .map(s -> {
                val bits = Splitter.on("->").splitToList(s);
                return Pair.of(bits.get(0), bits.get(1));
            })
            .forEach(p -> mappings.put(p.getKey(), p.getValue()));
        return mappings;
    }
1295166
public Map<String, Long> getDataSourceCounts()
  {
    return dataSources.entrySet().stream()
                      .collect(Collectors.toMap(Entry::getKey, entry -> entry.getValue().getNumSegments()));
  }
118538
public int countMapTasks() {
    int mapCount = 0;
    for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) {
      TaskStatus ts = (TaskStatus) it.next();
      if (ts.getIsMap() && isTaskRunning(ts)) {
        mapCount++;
      }
    }
    return mapCount;
  }
1129322
protected Map<String, List<MtasParserObject>> createCurrentList() {
    Map<String, List<MtasParserObject>> currentList = new HashMap<>();
    currentList.put(MAPPING_TYPE_RELATION, new ArrayList<MtasParserObject>());
    currentList.put(MAPPING_TYPE_RELATION_ANNOTATION,
        new ArrayList<MtasParserObject>());
    currentList.put(MAPPING_TYPE_REF, new ArrayList<MtasParserObject>());
    currentList.put(MAPPING_TYPE_GROUP, new ArrayList<MtasParserObject>());
    currentList.put(MAPPING_TYPE_GROUP_ANNOTATION,
        new ArrayList<MtasParserObject>());
    currentList.put(MAPPING_TYPE_WORD, new ArrayList<MtasParserObject>());
    currentList.put(MAPPING_TYPE_WORD_ANNOTATION,
        new ArrayList<MtasParserObject>());
    return currentList;
  }
986808
public static Map<String, Integer> createNGrams(String inputQuery, boolean removeStopWords) {
    List<String> wordsInString =
        Lists.newArrayList(Stemmer.replaceIllegalCharacter(inputQuery).split(" "));
    if (removeStopWords) wordsInString.removeAll(STOPWORDSLIST);
    List<String> stemmedWordsInString =
        wordsInString.stream().map(Stemmer::stem).collect(Collectors.toList());
    Map<String, Integer> tokens = new HashMap<>();
    // Padding the string
    for (String singleWord : stemmedWordsInString) {
      if (!StringUtils.isEmpty(singleWord)) {
        // The s$ will be the produced from two words.
        StringBuilder singleString = new StringBuilder(singleWord.length() + 2);
        singleString.append('^').append(singleWord.toLowerCase()).append('$');
        int length = singleString.length();
        for (int i = 0; i < length - 1; i++) {
          String token = null;
          if (i + N_GRAMS < length) {
            token = singleString.substring(i, i + N_GRAMS);

          } else {
            token = singleString.substring(length - 2);
          }

          if (!tokens.containsKey(token)) {
            tokens.put(token, 1);
          } else {
            tokens.put(token, (tokens.get(token) + 1));
          }
        }
      }
    }

    return tokens;
  }
642537
@Override
	public <S extends T> long count(final Example<S> example) {
		final Map<String, Object> bindVars = new HashMap<>();
		final String predicate = exampleConverter.convertExampleToPredicate(example, bindVars);
		final String filter = predicate.length() == 0 ? "" : " FILTER " + predicate;
		final String query = String.format("FOR e IN %s%s COLLECT WITH COUNT INTO length RETURN length",
			getCollectionName(), filter);
		final ArangoCursor<Long> cursor = arangoOperations.query(query, bindVars, null, Long.class);
		return cursor.next();
	}
1324068
public static <K, V> CounterMap<K, V> parallelCounterMap() {
        CounterMap<K, V> totalWords = new CounterMap<>();
        return totalWords;
    }
1169283
public SensitiveWordListResult getSensitiveWordList(int start, int count)
            throws APIConnectionException, APIRequestException {
        Preconditions.checkArgument(start >= 0, "start should not less than 0");
        Preconditions.checkArgument(count <= 2000, "count should not bigger than 2000");
        ResponseWrapper responseWrapper = _httpClient.sendGet(_baseUrl + sensitiveWordPath + "?start=" + start + "&count=" + count);
        return _gson.fromJson(responseWrapper.responseContent, SensitiveWordListResult.class);
    }
1239590
private Map<String, AtomicInteger> frequency(List<Word> words){
        Map<String, AtomicInteger> frequency =new HashMap<>();
        words.forEach(word->{
            frequency.computeIfAbsent(word.getText(), k -> new AtomicInteger()).incrementAndGet();
        });
        return frequency;
    }
1126632
public static <V> Map<V, V> convertListToMap(List<V> list) {
        Map<V, V> map = new HashMap<V, V>();
        if(list.size() % 2 != 0)
            throw new VoldemortException("Failed to convert list to map.");
        for(int i = 0; i < list.size(); i += 2) {
            map.put(list.get(i), list.get(i + 1));
        }
        return map;
    }
105786
public static <T> Map<T, Long> countBy(Collection<T> collection) {
        return countBy(collection.stream());
    }
1068299
def countByValue(self):
        
        def countPartition(iterator):
            counts = defaultdict(int)
            for obj in iterator:
                counts[obj] += 1
            yield counts

        def mergeMaps(m1, m2):
            for k, v in m2.items():
                m1[k] += v
            return m1
        return self.mapPartitions(countPartition).reduce(mergeMaps)