android/guava/src/com/google/common/collect/Multisets.java
private static <E> boolean addAllImpl(Multiset<E> self, Multiset<? extends E> elements) {
    // It'd be nice if we could specialize for ImmutableMultiset here without also retaining
    // its code when it's not in scope...
    if (elements instanceof AbstractMapBasedMultiset) {
      return addAllImpl(self, (AbstractMapBasedMultiset<? extends E>) elements);
    } else if (elements.isEmpty()) {
      return false;
    } else {
      for (Multiset.Entry<? extends E> entry : elements.entrySet()) {
        self.add(entry.getElement(), entry.getCount());
      }
      return true;
    }
  }
private static <E> boolean addAllImpl(Multiset<E> self, Multiset<? extends E> elements) {
    // It'd be nice if we could specialize for ImmutableMultiset here without also retaining
    // its code when it's not in scope...
    if (elements instanceof AbstractMapBasedMultiset) {
      return addAllImpl(self, (AbstractMapBasedMultiset<? extends E>) elements);
    } else if (elements.isEmpty()) {
      return false;
    } else {
      for (Multiset.Entry<? extends E> entry : elements.entrySet()) {
        self.add(entry.getElement(), entry.getCount());
      }
      return true;
    }
  }
private static < E > boolean addAllImpl ( Multiset < E > self , Multiset < ? extends E > elements ) { // It'd be nice if we could specialize for ImmutableMultiset here without also retaining // its code when it's not in scope... if ( elements instanceof AbstractMapBasedMultiset ) { return addAllImpl ( self , ( AbstractMapBasedMultiset < ? extends E > ) elements ) ; } else if ( elements . isEmpty ( ) ) { return false ; } else { for ( Multiset . Entry < ? extends E > entry : elements . entrySet ( ) ) { self . add ( entry . getElement ( ) , entry . getCount ( ) ) ; } return true ; } }
A specialization of {@code addAllImpl} for when {@code elements} is itself a Multiset.
A specialization of {