Skip to content

Commit 22170f1

Browse files
cpovirkGoogle Java Core Libraries
authored andcommitted
Steer users of newMultimap and friends toward MultimapBuilder.
RELNOTES=n/a PiperOrigin-RevId: 738165097
1 parent 6731e36 commit 22170f1

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

android/guava/src/com/google/common/collect/Multimaps.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ private Multimaps() {}
173173

174174
/**
175175
* Creates a new {@code Multimap} backed by {@code map}, whose internal value collections are
176-
* generated by {@code factory}.
176+
* generated by {@code factory}. Most users should prefer {@link MultimapBuilder}, though a small
177+
* number of users will need this method to cover map or collection types that {@link
178+
* MultimapBuilder} does not support.
177179
*
178180
* <p><b>Warning: do not use</b> this method when the collections returned by {@code factory}
179181
* implement either {@link List} or {@code Set}! Use the more specific method {@link
@@ -296,7 +298,9 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo
296298

297299
/**
298300
* Creates a new {@code ListMultimap} that uses the provided map and factory. It can generate a
299-
* multimap based on arbitrary {@link Map} and {@link List} classes.
301+
* multimap based on arbitrary {@link Map} and {@link List} classes. Most users should prefer
302+
* {@link MultimapBuilder}, though a small number of users will need this method to cover map or
303+
* collection types that {@link MultimapBuilder} does not support.
300304
*
301305
* <p>The {@code factory}-generated and {@code map} classes determine the multimap iteration
302306
* order. They also specify the behavior of the {@code equals}, {@code hashCode}, and {@code
@@ -380,7 +384,9 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo
380384

381385
/**
382386
* Creates a new {@code SetMultimap} that uses the provided map and factory. It can generate a
383-
* multimap based on arbitrary {@link Map} and {@link Set} classes.
387+
* multimap based on arbitrary {@link Map} and {@link Set} classes. Most users should prefer
388+
* {@link MultimapBuilder}, though a small number of users will need this method to cover map or
389+
* collection types that {@link MultimapBuilder} does not support.
384390
*
385391
* <p>The {@code factory}-generated and {@code map} classes determine the multimap iteration
386392
* order. They also specify the behavior of the {@code equals}, {@code hashCode}, and {@code

guava/src/com/google/common/collect/Multimaps.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ private Multimaps() {}
172172

173173
/**
174174
* Creates a new {@code Multimap} backed by {@code map}, whose internal value collections are
175-
* generated by {@code factory}.
175+
* generated by {@code factory}. Most users should prefer {@link MultimapBuilder}, though a small
176+
* number of users will need this method to cover map or collection types that {@link
177+
* MultimapBuilder} does not support.
176178
*
177179
* <p><b>Warning: do not use</b> this method when the collections returned by {@code factory}
178180
* implement either {@link List} or {@code Set}! Use the more specific method {@link
@@ -295,7 +297,9 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo
295297

296298
/**
297299
* Creates a new {@code ListMultimap} that uses the provided map and factory. It can generate a
298-
* multimap based on arbitrary {@link Map} and {@link List} classes.
300+
* multimap based on arbitrary {@link Map} and {@link List} classes. Most users should prefer
301+
* {@link MultimapBuilder}, though a small number of users will need this method to cover map or
302+
* collection types that {@link MultimapBuilder} does not support.
299303
*
300304
* <p>The {@code factory}-generated and {@code map} classes determine the multimap iteration
301305
* order. They also specify the behavior of the {@code equals}, {@code hashCode}, and {@code
@@ -379,7 +383,9 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo
379383

380384
/**
381385
* Creates a new {@code SetMultimap} that uses the provided map and factory. It can generate a
382-
* multimap based on arbitrary {@link Map} and {@link Set} classes.
386+
* multimap based on arbitrary {@link Map} and {@link Set} classes. Most users should prefer
387+
* {@link MultimapBuilder}, though a small number of users will need this method to cover map or
388+
* collection types that {@link MultimapBuilder} does not support.
383389
*
384390
* <p>The {@code factory}-generated and {@code map} classes determine the multimap iteration
385391
* order. They also specify the behavior of the {@code equals}, {@code hashCode}, and {@code

0 commit comments

Comments
 (0)