code: static boolean retainAllImpl(Multiset<?> self, Collection<?> elementsToRetain) {
      checkNotNull(elementsToRetain);
      Collection<?> collection =
          (elementsToRetain instanceof Multiset)
              ? ((Multiset<?>) elementsToRetain).elementSet()
              : elementsToRetain;
  
      return self.elementSet().retainAll(collection);
    }
docs: An implementation of {@link Multiset#retainAll}.