예제 #1
0
  public StringIntPair[] getCounts(String key) {
    ObjectIntHashMap<String> map = get(key);
    if (map == null) return null;
    String value;
    int i = 0;

    StringIntPair[] ps = new StringIntPair[map.size() - 1];

    for (ObjectCursor<String> cur : map.keys()) {
      if (!(value = cur.value).equals(TOTAL)) ps[i++] = new StringIntPair(value, map.get(value));
    }

    return ps;
  }
예제 #2
0
  public ObjectIntPair<String> getBestCount(String key) {
    ObjectIntHashMap<String> map = get(key);

    if (map != null) {
      ObjectIntPair<String> max = new ObjectIntPair<String>(null, -1);
      int count;

      for (ObjectCursor<String> cur : map.keys()) {
        count = map.get(cur.value);
        if (count > max.i) max.set(cur.value, count);
      }

      return max;
    }

    return null;
  }