guava/src/com/google/common/collect/AbstractMapBasedMultimap.java
@Override
  public boolean put(@Nullable K key, @Nullable V value) {
    Collection<V> collection = map.get(key);
    if (collection == null) {
      collection = createCollection(key);
      if (collection.add(value)) {
        totalSize++;
        map.put(key, collection);
        return true;
      } else {
        throw new AssertionError("New Collection violated the Collection spec");
      }
    } else if (collection.add(value)) {
      totalSize++;
      return true;
    } else {
      return false;
    }
  }
@Override
  public boolean put(@Nullable K key, @Nullable V value) {
    Collection<V> collection = map.get(key);
    if (collection == null) {
      collection = createCollection(key);
      if (collection.add(value)) {
        totalSize++;
        map.put(key, collection);
        return true;
      } else {
        throw new AssertionError("New Collection violated the Collection spec");
      }
    } else if (collection.add(value)) {
      totalSize++;
      return true;
    } else {
      return false;
    }
  }
@ Override public boolean put ( @ Nullable K key , @ Nullable V value ) { Collection < V > collection = map . get ( key ) ; if ( collection == null ) { collection = createCollection ( key ) ; if ( collection . add ( value ) ) { totalSize ++ ; map . put ( key , collection ) ; return true ; } else { throw new AssertionError ( "New Collection violated the Collection spec" ) ; } } else if ( collection . add ( value ) ) { totalSize ++ ; return true ; } else { return false ; } }
Modification Operations
Modification Operations