Program: 60251
Project: 60251
Buggy source:
/** 
 * Creates a new   {@code ListMultimap} that uses the provided map and factory.It can generate a multimap based on arbitrary  {@link Map} and {@link List}classes. <p>The   {@code factory}-generated and   {@code map} classes determine themultimap iteration order. They also specify the behavior of the {@code equals},   {@code hashCode}, and   {@code toString} methods for themultimap and its returned views. The multimap's  {@code get},   {@code removeAll}, and   {@code replaceValues} methods return {@code RandomAccess}lists if the factory does. However, the multimap's   {@code get} methodreturns instances of a different class than does  {@code factory.get()}. <p>The multimap is serializable if   {@code map},   {@code factory}, the lists generated by   {@code factory}, and the multimap contents are all serializable. <p>The multimap is not threadsafe when any concurrent operations update the multimap, even if   {@code map} and the instances generated by{@code factory} are. Concurrent read operations will work correctly. Toallow concurrent update operations, wrap the multimap with a call to {@link #synchronizedListMultimap}. <p>Call this method only when the simpler methods  {@link ArrayListMultimap#create()} and {@link LinkedListMultimap#create()}won't suffice. <p>Note: the multimap assumes complete ownership over of   {@code map} andthe lists returned by  {@code factory}. Those objects should not be manually updated and they should not use soft, weak, or phantom references.
 * @param map place to store the mapping from each key to its correspondingvalues
 * @param factory supplier of new, empty lists that will each hold all valuesfor a given key
 * @throws IllegalArgumentException if {@code map} is not empty
 */
public static <K,V>ListMultimap<K,V> newListMultimap(Map<K,Collection<V>> map,final Supplier<? extends List<V>> factory){
  return new CustomListMultimap<K,V>(map,factory);
}

Fixed version (ground truth):
/** 
 * Creates a new   {@code ListMultimap} that uses the provided map and factory.It can generate a multimap based on arbitrary  {@link Map} and {@link List}classes. <p>The   {@code factory}-generated and   {@code map} classes determine themultimap iteration order. They also specify the behavior of the {@code equals},   {@code hashCode}, and   {@code toString} methods for themultimap and its returned views. The multimap's  {@code get},   {@code removeAll}, and   {@code replaceValues} methods return {@code RandomAccess}lists if the factory does. However, the multimap's   {@code get} methodreturns instances of a different class than does  {@code factory.get()}. <p>The multimap is serializable if   {@code map},   {@code factory}, the lists generated by   {@code factory}, and the multimap contents are all serializable. <p>The multimap is not threadsafe when any concurrent operations update the multimap, even if   {@code map} and the instances generated by{@code factory} are. Concurrent read operations will work correctly. Toallow concurrent update operations, wrap the multimap with a call to {@link #synchronizedListMultimap}. <p>Call this method only when the simpler methods  {@link ArrayListMultimap#create()} and {@link LinkedListMultimap#create()}won't suffice. <p>Note: the multimap assumes complete ownership over of   {@code map} andthe lists returned by  {@code factory}. Those objects should not be manually updated, they should be empty when provided, and they should not use soft, weak, or phantom references.
 * @param map place to store the mapping from each key to its correspondingvalues
 * @param factory supplier of new, empty lists that will each hold all valuesfor a given key
 * @throws IllegalArgumentException if {@code map} is not empty
 */
public static <K,V>ListMultimap<K,V> newListMultimap(Map<K,Collection<V>> map,final Supplier<? extends List<V>> factory){
  return new CustomListMultimap<K,V>(map,factory);
}