/**
  * Puts all pairs in the given map. If the map implements the interface of this map, it uses the
  * faster iterators.
  *
  * @param m a map.
  */
 @SuppressWarnings("unchecked")
 public void putAll(Map<? extends Short, ? extends Short> m) {
   int n = m.size();
   final Iterator<? extends Map.Entry<? extends Short, ? extends Short>> i =
       m.entrySet().iterator();
   if (m instanceof Short2ShortMap) {
     Short2ShortMap.Entry e;
     while (n-- != 0) {
       e = (Short2ShortMap.Entry) i.next();
       put(e.getShortKey(), e.getShortValue());
     }
   } else {
     Map.Entry<? extends Short, ? extends Short> e;
     while (n-- != 0) {
       e = i.next();
       put(e.getKey(), e.getValue());
     }
   }
 }
  public String toString() {
    final StringBuilder s = new StringBuilder();
    final ObjectIterator<? extends Map.Entry<Short, Short>> i = entrySet().iterator();
    int n = size();
    Short2ShortMap.Entry e;
    boolean first = true;

    s.append("{");

    while (n-- != 0) {
      if (first) first = false;
      else s.append(", ");

      e = (Short2ShortMap.Entry) i.next();

      s.append(String.valueOf(e.getShortKey()));
      s.append("=>");

      s.append(String.valueOf(e.getShortValue()));
    }

    s.append("}");
    return s.toString();
  }