1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2 <!--NewPage--> 3 <HTML> 4 <HEAD> 5 <!-- Generated by javadoc (build 1.6.0-google-internal) on Mon Jan 04 20:47:59 PST 2010 --> 6 <TITLE> 7 Maps (Guava Libraries 2010.01.04) 8 </TITLE> 9 10 <META NAME="date" CONTENT="2010-01-04"> 11 12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> 13 14 <SCRIPT type="text/javascript"> 15 function windowTitle() 16 { 17 if (location.href.indexOf('is-external=true') == -1) { 18 parent.document.title="Maps (Guava Libraries 2010.01.04)"; 19 } 20 } 21 </SCRIPT> 22 <NOSCRIPT> 23 </NOSCRIPT> 24 25 </HEAD> 26 27 <BODY BGCOLOR="white" onload="windowTitle();"> 28 <HR> 29 30 31 <!-- ========= START OF TOP NAVBAR ======= --> 32 <A NAME="navbar_top"><!-- --></A> 33 <A HREF="#skip-navbar_top" title="Skip navigation links"></A> 34 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 35 <TR> 36 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 37 <A NAME="navbar_top_firstrow"><!-- --></A> 38 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 39 <TR ALIGN="center" VALIGN="top"> 40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 42 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Maps.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 48 </TR> 49 </TABLE> 50 </TD> 51 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 52 </EM> 53 </TD> 54 </TR> 55 56 <TR> 57 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 58 <A HREF="../../../../com/google/common/collect/MapMaker.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A> 59 <A HREF="../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD> 60 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 61 <A HREF="../../../../index.html?com/google/common/collect/Maps.html" target="_top"><B>FRAMES</B></A> 62 <A HREF="Maps.html" target="_top"><B>NO FRAMES</B></A> 63 <SCRIPT type="text/javascript"> 64 <!-- 65 if(window==top) { 66 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 67 } 68 //--> 69 </SCRIPT> 70 <NOSCRIPT> 71 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 72 </NOSCRIPT> 73 74 75 </FONT></TD> 76 </TR> 77 <TR> 78 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 79 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 80 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 81 DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 82 </TR> 83 </TABLE> 84 <A NAME="skip-navbar_top"></A> 85 <!-- ========= END OF TOP NAVBAR ========= --> 86 87 <HR> 88 <!-- ======== START OF CLASS DATA ======== --> 89 <H2> 90 <FONT SIZE="-1"> 91 com.google.common.collect</FONT> 92 <BR> 93 Class Maps</H2> 94 <PRE> 95 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> 96 <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.collect.Maps</B> 97 </PRE> 98 <HR> 99 <DL> 100 <DT><PRE>public final class <B>Maps</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL> 101 </PRE> 102 103 <P> 104 Static utility methods pertaining to <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util"><CODE>Map</CODE></A> instances. Also see this 105 class's counterparts <A HREF="../../../../com/google/common/collect/Lists.html" title="class in com.google.common.collect"><CODE>Lists</CODE></A> and <A HREF="../../../../com/google/common/collect/Sets.html" title="class in com.google.common.collect"><CODE>Sets</CODE></A>. 106 <P> 107 108 <P> 109 <DL> 110 <DT><B>Since:</B></DT> 111 <DD>2010.01.04 <b>stable</b> (imported from Google Collections Library)</DD> 112 <DT><B>Author:</B></DT> 113 <DD>Kevin Bourrillion, Mike Bostock, Isaac Shum</DD> 114 </DL> 115 <HR> 116 117 <P> 118 119 <!-- ========== METHOD SUMMARY =========== --> 120 121 <A NAME="method_summary"><!-- --></A> 122 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 123 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 124 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 125 <B>Method Summary</B></FONT></TH> 126 </TR> 127 <TR BGCOLOR="white" CLASS="TableRowColor"> 128 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 129 <CODE>static 130 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 131 <TR ALIGN="right" VALIGN=""> 132 <TD NOWRAP><FONT SIZE="-1"> 133 <CODE><K,V> <A HREF="../../../../com/google/common/collect/MapDifference.html" title="interface in com.google.common.collect">MapDifference</A><K,V></CODE></FONT></TD> 134 </TR> 135 </TABLE> 136 </CODE></FONT></TD> 137 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#difference(java.util.Map, java.util.Map)">difference</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><? extends K,? extends V> left, 138 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><? extends K,? extends V> right)</CODE> 139 140 <BR> 141 Computes the difference between two maps.</TD> 142 </TR> 143 <TR BGCOLOR="white" CLASS="TableRowColor"> 144 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 145 <CODE>static 146 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 147 <TR ALIGN="right" VALIGN=""> 148 <TD NOWRAP><FONT SIZE="-1"> 149 <CODE><K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V></CODE></FONT></TD> 150 </TR> 151 </TABLE> 152 </CODE></FONT></TD> 153 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#filterEntries(java.util.Map, com.google.common.base.Predicate)">filterEntries</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V> unfiltered, 154 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true" title="class or interface in java.util">Map.Entry</A><K,V>> entryPredicate)</CODE> 155 156 <BR> 157 Returns a map containing the mappings in <code>unfiltered</code> that satisfy a 158 predicate.</TD> 159 </TR> 160 <TR BGCOLOR="white" CLASS="TableRowColor"> 161 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 162 <CODE>static 163 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 164 <TR ALIGN="right" VALIGN=""> 165 <TD NOWRAP><FONT SIZE="-1"> 166 <CODE><K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V></CODE></FONT></TD> 167 </TR> 168 </TABLE> 169 </CODE></FONT></TD> 170 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#filterKeys(java.util.Map, com.google.common.base.Predicate)">filterKeys</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V> unfiltered, 171 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super K> keyPredicate)</CODE> 172 173 <BR> 174 Returns a map containing the mappings in <code>unfiltered</code> whose keys 175 satisfy a predicate.</TD> 176 </TR> 177 <TR BGCOLOR="white" CLASS="TableRowColor"> 178 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 179 <CODE>static 180 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 181 <TR ALIGN="right" VALIGN=""> 182 <TD NOWRAP><FONT SIZE="-1"> 183 <CODE><K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V></CODE></FONT></TD> 184 </TR> 185 </TABLE> 186 </CODE></FONT></TD> 187 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#filterValues(java.util.Map, com.google.common.base.Predicate)">filterValues</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V> unfiltered, 188 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super V> valuePredicate)</CODE> 189 190 <BR> 191 Returns a map containing the mappings in <code>unfiltered</code> whose values 192 satisfy a predicate.</TD> 193 </TR> 194 <TR BGCOLOR="white" CLASS="TableRowColor"> 195 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 196 <CODE>static <A HREF="../../../../com/google/common/collect/ImmutableMap.html" title="class in com.google.common.collect">ImmutableMap</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>,<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>></CODE></FONT></TD> 197 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#fromProperties(java.util.Properties)">fromProperties</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Properties.html?is-external=true" title="class or interface in java.util">Properties</A> properties)</CODE> 198 199 <BR> 200 Creates an <code>ImmutableMap<String, String></code> from a <code>Properties</code> 201 instance.</TD> 202 </TR> 203 <TR BGCOLOR="white" CLASS="TableRowColor"> 204 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 205 <CODE>static 206 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 207 <TR ALIGN="right" VALIGN=""> 208 <TD NOWRAP><FONT SIZE="-1"> 209 <CODE><K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true" title="class or interface in java.util">Map.Entry</A><K,V></CODE></FONT></TD> 210 </TR> 211 </TABLE> 212 </CODE></FONT></TD> 213 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#immutableEntry(K, V)">immutableEntry</A></B>(K key, 214 V value)</CODE> 215 216 <BR> 217 Returns an immutable map entry with the specified key and value.</TD> 218 </TR> 219 <TR BGCOLOR="white" CLASS="TableRowColor"> 220 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 221 <CODE>static 222 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 223 <TR ALIGN="right" VALIGN=""> 224 <TD NOWRAP><FONT SIZE="-1"> 225 <CODE><K extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A><K>,V> 226 <BR> 227 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumMap.html?is-external=true" title="class or interface in java.util">EnumMap</A><K,V></CODE></FONT></TD> 228 </TR> 229 </TABLE> 230 </CODE></FONT></TD> 231 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#newEnumMap(java.lang.Class)">newEnumMap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><K> type)</CODE> 232 233 <BR> 234 Creates an <code>EnumMap</code> instance.</TD> 235 </TR> 236 <TR BGCOLOR="white" CLASS="TableRowColor"> 237 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 238 <CODE>static 239 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 240 <TR ALIGN="right" VALIGN=""> 241 <TD NOWRAP><FONT SIZE="-1"> 242 <CODE><K extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A><K>,V> 243 <BR> 244 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumMap.html?is-external=true" title="class or interface in java.util">EnumMap</A><K,V></CODE></FONT></TD> 245 </TR> 246 </TABLE> 247 </CODE></FONT></TD> 248 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#newEnumMap(java.util.Map)">newEnumMap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,? extends V> map)</CODE> 249 250 <BR> 251 Creates an <code>EnumMap</code> with the same mappings as the specified map.</TD> 252 </TR> 253 <TR BGCOLOR="white" CLASS="TableRowColor"> 254 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 255 <CODE>static 256 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 257 <TR ALIGN="right" VALIGN=""> 258 <TD NOWRAP><FONT SIZE="-1"> 259 <CODE><K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashMap.html?is-external=true" title="class or interface in java.util">HashMap</A><K,V></CODE></FONT></TD> 260 </TR> 261 </TABLE> 262 </CODE></FONT></TD> 263 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#newHashMap()">newHashMap</A></B>()</CODE> 264 265 <BR> 266 Creates a <i>mutable</i>, empty <code>HashMap</code> instance.</TD> 267 </TR> 268 <TR BGCOLOR="white" CLASS="TableRowColor"> 269 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 270 <CODE>static 271 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 272 <TR ALIGN="right" VALIGN=""> 273 <TD NOWRAP><FONT SIZE="-1"> 274 <CODE><K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashMap.html?is-external=true" title="class or interface in java.util">HashMap</A><K,V></CODE></FONT></TD> 275 </TR> 276 </TABLE> 277 </CODE></FONT></TD> 278 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#newHashMap(java.util.Map)">newHashMap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><? extends K,? extends V> map)</CODE> 279 280 <BR> 281 Creates a <i>mutable</i> <code>HashMap</code> instance with the same mappings as 282 the specified map.</TD> 283 </TR> 284 <TR BGCOLOR="white" CLASS="TableRowColor"> 285 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 286 <CODE>static 287 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 288 <TR ALIGN="right" VALIGN=""> 289 <TD NOWRAP><FONT SIZE="-1"> 290 <CODE><K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashMap.html?is-external=true" title="class or interface in java.util">HashMap</A><K,V></CODE></FONT></TD> 291 </TR> 292 </TABLE> 293 </CODE></FONT></TD> 294 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#newHashMapWithExpectedSize(int)">newHashMapWithExpectedSize</A></B>(int expectedSize)</CODE> 295 296 <BR> 297 Creates a <code>HashMap</code> instance with enough capacity to hold the 298 specified number of elements without rehashing.</TD> 299 </TR> 300 <TR BGCOLOR="white" CLASS="TableRowColor"> 301 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 302 <CODE>static 303 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 304 <TR ALIGN="right" VALIGN=""> 305 <TD NOWRAP><FONT SIZE="-1"> 306 <CODE><K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/IdentityHashMap.html?is-external=true" title="class or interface in java.util">IdentityHashMap</A><K,V></CODE></FONT></TD> 307 </TR> 308 </TABLE> 309 </CODE></FONT></TD> 310 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#newIdentityHashMap()">newIdentityHashMap</A></B>()</CODE> 311 312 <BR> 313 Creates an <code>IdentityHashMap</code> instance.</TD> 314 </TR> 315 <TR BGCOLOR="white" CLASS="TableRowColor"> 316 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 317 <CODE>static 318 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 319 <TR ALIGN="right" VALIGN=""> 320 <TD NOWRAP><FONT SIZE="-1"> 321 <CODE><K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/LinkedHashMap.html?is-external=true" title="class or interface in java.util">LinkedHashMap</A><K,V></CODE></FONT></TD> 322 </TR> 323 </TABLE> 324 </CODE></FONT></TD> 325 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#newLinkedHashMap()">newLinkedHashMap</A></B>()</CODE> 326 327 <BR> 328 Creates a <i>mutable</i>, empty, insertion-ordered <code>LinkedHashMap</code> 329 instance.</TD> 330 </TR> 331 <TR BGCOLOR="white" CLASS="TableRowColor"> 332 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 333 <CODE>static 334 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 335 <TR ALIGN="right" VALIGN=""> 336 <TD NOWRAP><FONT SIZE="-1"> 337 <CODE><K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/LinkedHashMap.html?is-external=true" title="class or interface in java.util">LinkedHashMap</A><K,V></CODE></FONT></TD> 338 </TR> 339 </TABLE> 340 </CODE></FONT></TD> 341 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#newLinkedHashMap(java.util.Map)">newLinkedHashMap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><? extends K,? extends V> map)</CODE> 342 343 <BR> 344 Creates a <i>mutable</i>, insertion-ordered <code>LinkedHashMap</code> instance 345 with the same mappings as the specified map.</TD> 346 </TR> 347 <TR BGCOLOR="white" CLASS="TableRowColor"> 348 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 349 <CODE>static 350 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 351 <TR ALIGN="right" VALIGN=""> 352 <TD NOWRAP><FONT SIZE="-1"> 353 <CODE><K extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>,V> 354 <BR> 355 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html?is-external=true" title="class or interface in java.util">TreeMap</A><K,V></CODE></FONT></TD> 356 </TR> 357 </TABLE> 358 </CODE></FONT></TD> 359 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#newTreeMap()">newTreeMap</A></B>()</CODE> 360 361 <BR> 362 Creates a <i>mutable</i>, empty <code>TreeMap</code> instance using the natural 363 ordering of its elements.</TD> 364 </TR> 365 <TR BGCOLOR="white" CLASS="TableRowColor"> 366 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 367 <CODE>static 368 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 369 <TR ALIGN="right" VALIGN=""> 370 <TD NOWRAP><FONT SIZE="-1"> 371 <CODE><C,K extends C,V> 372 <BR> 373 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html?is-external=true" title="class or interface in java.util">TreeMap</A><K,V></CODE></FONT></TD> 374 </TR> 375 </TABLE> 376 </CODE></FONT></TD> 377 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#newTreeMap(java.util.Comparator)">newTreeMap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A><C> comparator)</CODE> 378 379 <BR> 380 Creates a <i>mutable</i>, empty <code>TreeMap</code> instance using the given 381 comparator.</TD> 382 </TR> 383 <TR BGCOLOR="white" CLASS="TableRowColor"> 384 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 385 <CODE>static 386 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 387 <TR ALIGN="right" VALIGN=""> 388 <TD NOWRAP><FONT SIZE="-1"> 389 <CODE><K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html?is-external=true" title="class or interface in java.util">TreeMap</A><K,V></CODE></FONT></TD> 390 </TR> 391 </TABLE> 392 </CODE></FONT></TD> 393 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#newTreeMap(java.util.SortedMap)">newTreeMap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/SortedMap.html?is-external=true" title="class or interface in java.util">SortedMap</A><K,? extends V> map)</CODE> 394 395 <BR> 396 Creates a <i>mutable</i> <code>TreeMap</code> instance with the same mappings as 397 the specified map and using the same ordering as the specified map.</TD> 398 </TR> 399 <TR BGCOLOR="white" CLASS="TableRowColor"> 400 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 401 <CODE>static 402 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 403 <TR ALIGN="right" VALIGN=""> 404 <TD NOWRAP><FONT SIZE="-1"> 405 <CODE><K,V> <A HREF="../../../../com/google/common/collect/BiMap.html" title="interface in com.google.common.collect">BiMap</A><K,V></CODE></FONT></TD> 406 </TR> 407 </TABLE> 408 </CODE></FONT></TD> 409 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#synchronizedBiMap(com.google.common.collect.BiMap)">synchronizedBiMap</A></B>(<A HREF="../../../../com/google/common/collect/BiMap.html" title="interface in com.google.common.collect">BiMap</A><K,V> bimap)</CODE> 410 411 <BR> 412 Returns a synchronized (thread-safe) bimap backed by the specified bimap.</TD> 413 </TR> 414 <TR BGCOLOR="white" CLASS="TableRowColor"> 415 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 416 <CODE>static 417 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 418 <TR ALIGN="right" VALIGN=""> 419 <TD NOWRAP><FONT SIZE="-1"> 420 <CODE><K,V1,V2> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V2></CODE></FONT></TD> 421 </TR> 422 </TABLE> 423 </CODE></FONT></TD> 424 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#transformValues(java.util.Map, com.google.common.base.Function)">transformValues</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V1> fromMap, 425 <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><? super V1,V2> function)</CODE> 426 427 <BR> 428 Returns a view of a map where each value is transformed by a function.</TD> 429 </TR> 430 <TR BGCOLOR="white" CLASS="TableRowColor"> 431 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 432 <CODE>static 433 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 434 <TR ALIGN="right" VALIGN=""> 435 <TD NOWRAP><FONT SIZE="-1"> 436 <CODE><K,V> <A HREF="../../../../com/google/common/collect/ImmutableMap.html" title="class in com.google.common.collect">ImmutableMap</A><K,V></CODE></FONT></TD> 437 </TR> 438 </TABLE> 439 </CODE></FONT></TD> 440 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#uniqueIndex(java.lang.Iterable, com.google.common.base.Function)">uniqueIndex</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><V> values, 441 <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><? super V,K> keyFunction)</CODE> 442 443 <BR> 444 Returns an immutable map for which the <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true#values()" title="class or interface in java.util"><CODE>Map.values()</CODE></A> are the given 445 elements in the given order, and each key is the product of invoking a 446 supplied function on its corresponding value.</TD> 447 </TR> 448 <TR BGCOLOR="white" CLASS="TableRowColor"> 449 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 450 <CODE>static 451 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 452 <TR ALIGN="right" VALIGN=""> 453 <TD NOWRAP><FONT SIZE="-1"> 454 <CODE><K,V> <A HREF="../../../../com/google/common/collect/BiMap.html" title="interface in com.google.common.collect">BiMap</A><K,V></CODE></FONT></TD> 455 </TR> 456 </TABLE> 457 </CODE></FONT></TD> 458 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Maps.html#unmodifiableBiMap(com.google.common.collect.BiMap)">unmodifiableBiMap</A></B>(<A HREF="../../../../com/google/common/collect/BiMap.html" title="interface in com.google.common.collect">BiMap</A><? extends K,? extends V> bimap)</CODE> 459 460 <BR> 461 Returns an unmodifiable view of the specified bimap.</TD> 462 </TR> 463 </TABLE> 464 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 465 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 466 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 467 <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> 468 </TR> 469 <TR BGCOLOR="white" CLASS="TableRowColor"> 470 <TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> 471 </TR> 472 </TABLE> 473 474 <P> 475 476 <!-- ============ METHOD DETAIL ========== --> 477 478 <A NAME="method_detail"><!-- --></A> 479 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 480 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 481 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 482 <B>Method Detail</B></FONT></TH> 483 </TR> 484 </TABLE> 485 486 <A NAME="newHashMap()"><!-- --></A><H3> 487 newHashMap</H3> 488 <PRE> 489 public static <K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashMap.html?is-external=true" title="class or interface in java.util">HashMap</A><K,V> <B>newHashMap</B>()</PRE> 490 <DL> 491 <DD>Creates a <i>mutable</i>, empty <code>HashMap</code> instance. 492 493 <p><b>Note:</b> if mutability is not required, use <A HREF="../../../../com/google/common/collect/ImmutableMap.html#of()"><CODE>ImmutableMap.of()</CODE></A> instead. 494 495 <p><b>Note:</b> if <code>K</code> is an <code>enum</code> type, use <A HREF="../../../../com/google/common/collect/Maps.html#newEnumMap(java.lang.Class)"><CODE>newEnumMap(java.lang.Class<K>)</CODE></A> instead. 496 <P> 497 <DD><DL> 498 499 <DT><B>Returns:</B><DD>a new, empty <code>HashMap</code></DL> 500 </DD> 501 </DL> 502 <HR> 503 504 <A NAME="newHashMapWithExpectedSize(int)"><!-- --></A><H3> 505 newHashMapWithExpectedSize</H3> 506 <PRE> 507 public static <K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashMap.html?is-external=true" title="class or interface in java.util">HashMap</A><K,V> <B>newHashMapWithExpectedSize</B>(int expectedSize)</PRE> 508 <DL> 509 <DD>Creates a <code>HashMap</code> instance with enough capacity to hold the 510 specified number of elements without rehashing. 511 <P> 512 <DD><DL> 513 <DT><B>Parameters:</B><DD><CODE>expectedSize</CODE> - the expected size 514 <DT><B>Returns:</B><DD>a new, empty <code>HashMap</code> with enough 515 capacity to hold <code>expectedSize</code> elements without rehashing 516 <DT><B>Throws:</B> 517 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>expectedSize</code> is negative</DL> 518 </DD> 519 </DL> 520 <HR> 521 522 <A NAME="newHashMap(java.util.Map)"><!-- --></A><H3> 523 newHashMap</H3> 524 <PRE> 525 public static <K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashMap.html?is-external=true" title="class or interface in java.util">HashMap</A><K,V> <B>newHashMap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><? extends K,? extends V> map)</PRE> 526 <DL> 527 <DD>Creates a <i>mutable</i> <code>HashMap</code> instance with the same mappings as 528 the specified map. 529 530 <p><b>Note:</b> if mutability is not required, use <A HREF="../../../../com/google/common/collect/ImmutableMap.html#copyOf(java.util.Map)"><CODE>ImmutableMap.copyOf(Map)</CODE></A> instead. 531 532 <p><b>Note:</b> if <code>K</code> is an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang"><CODE>Enum</CODE></A> type, use <A HREF="../../../../com/google/common/collect/Maps.html#newEnumMap(java.lang.Class)"><CODE>newEnumMap(java.lang.Class<K>)</CODE></A> instead. 533 <P> 534 <DD><DL> 535 <DT><B>Parameters:</B><DD><CODE>map</CODE> - the mappings to be placed in the new map 536 <DT><B>Returns:</B><DD>a new <code>HashMap</code> initialized with the mappings from 537 <code>map</code></DL> 538 </DD> 539 </DL> 540 <HR> 541 542 <A NAME="newLinkedHashMap()"><!-- --></A><H3> 543 newLinkedHashMap</H3> 544 <PRE> 545 public static <K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/LinkedHashMap.html?is-external=true" title="class or interface in java.util">LinkedHashMap</A><K,V> <B>newLinkedHashMap</B>()</PRE> 546 <DL> 547 <DD>Creates a <i>mutable</i>, empty, insertion-ordered <code>LinkedHashMap</code> 548 instance. 549 550 <p><b>Note:</b> if mutability is not required, use <A HREF="../../../../com/google/common/collect/ImmutableMap.html#of()"><CODE>ImmutableMap.of()</CODE></A> instead. 551 <P> 552 <DD><DL> 553 554 <DT><B>Returns:</B><DD>a new, empty <code>LinkedHashMap</code></DL> 555 </DD> 556 </DL> 557 <HR> 558 559 <A NAME="newLinkedHashMap(java.util.Map)"><!-- --></A><H3> 560 newLinkedHashMap</H3> 561 <PRE> 562 public static <K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/LinkedHashMap.html?is-external=true" title="class or interface in java.util">LinkedHashMap</A><K,V> <B>newLinkedHashMap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><? extends K,? extends V> map)</PRE> 563 <DL> 564 <DD>Creates a <i>mutable</i>, insertion-ordered <code>LinkedHashMap</code> instance 565 with the same mappings as the specified map. 566 567 <p><b>Note:</b> if mutability is not required, use <A HREF="../../../../com/google/common/collect/ImmutableMap.html#copyOf(java.util.Map)"><CODE>ImmutableMap.copyOf(Map)</CODE></A> instead. 568 <P> 569 <DD><DL> 570 <DT><B>Parameters:</B><DD><CODE>map</CODE> - the mappings to be placed in the new map 571 <DT><B>Returns:</B><DD>a new, <code>LinkedHashMap</code> initialized with the 572 mappings from <code>map</code></DL> 573 </DD> 574 </DL> 575 <HR> 576 577 <A NAME="newTreeMap()"><!-- --></A><H3> 578 newTreeMap</H3> 579 <PRE> 580 public static <K extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html?is-external=true" title="class or interface in java.util">TreeMap</A><K,V> <B>newTreeMap</B>()</PRE> 581 <DL> 582 <DD>Creates a <i>mutable</i>, empty <code>TreeMap</code> instance using the natural 583 ordering of its elements. 584 585 <p><b>Note:</b> if mutability is not required, use <A HREF="../../../../com/google/common/collect/ImmutableSortedMap.html#of()"><CODE>ImmutableSortedMap.of()</CODE></A> instead. 586 <P> 587 <DD><DL> 588 589 <DT><B>Returns:</B><DD>a new, empty <code>TreeMap</code></DL> 590 </DD> 591 </DL> 592 <HR> 593 594 <A NAME="newTreeMap(java.util.SortedMap)"><!-- --></A><H3> 595 newTreeMap</H3> 596 <PRE> 597 public static <K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html?is-external=true" title="class or interface in java.util">TreeMap</A><K,V> <B>newTreeMap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/SortedMap.html?is-external=true" title="class or interface in java.util">SortedMap</A><K,? extends V> map)</PRE> 598 <DL> 599 <DD>Creates a <i>mutable</i> <code>TreeMap</code> instance with the same mappings as 600 the specified map and using the same ordering as the specified map. 601 602 <p><b>Note:</b> if mutability is not required, use <A HREF="../../../../com/google/common/collect/ImmutableSortedMap.html#copyOfSorted(java.util.SortedMap)"><CODE>ImmutableSortedMap.copyOfSorted(SortedMap)</CODE></A> instead. 603 <P> 604 <DD><DL> 605 <DT><B>Parameters:</B><DD><CODE>map</CODE> - the sorted map whose mappings are to be placed in the new map 606 and whose comparator is to be used to sort the new map 607 <DT><B>Returns:</B><DD>a new <code>TreeMap</code> initialized with the mappings from <code>map</code> and using the comparator of <code>map</code></DL> 608 </DD> 609 </DL> 610 <HR> 611 612 <A NAME="newTreeMap(java.util.Comparator)"><!-- --></A><H3> 613 newTreeMap</H3> 614 <PRE> 615 public static <C,K extends C,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html?is-external=true" title="class or interface in java.util">TreeMap</A><K,V> <B>newTreeMap</B>(<FONT SIZE="-1"><A HREF="http://jsr-305.googlecode.com/svn/trunk/javadoc/javax/annotation/Nullable.html?is-external=true" title="class or interface in javax.annotation">@Nullable</A></FONT> 616 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A><C> comparator)</PRE> 617 <DL> 618 <DD>Creates a <i>mutable</i>, empty <code>TreeMap</code> instance using the given 619 comparator. 620 621 <p><b>Note:</b> if mutability is not required, use <code>ImmutableSortedMap.orderedBy(comparator).build()</code> instead. 622 <P> 623 <DD><DL> 624 <DT><B>Parameters:</B><DD><CODE>comparator</CODE> - the comparator to sort the keys with 625 <DT><B>Returns:</B><DD>a new, empty <code>TreeMap</code></DL> 626 </DD> 627 </DL> 628 <HR> 629 630 <A NAME="newEnumMap(java.lang.Class)"><!-- --></A><H3> 631 newEnumMap</H3> 632 <PRE> 633 public static <K extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A><K>,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumMap.html?is-external=true" title="class or interface in java.util">EnumMap</A><K,V> <B>newEnumMap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><K> type)</PRE> 634 <DL> 635 <DD>Creates an <code>EnumMap</code> instance. 636 <P> 637 <DD><DL> 638 <DT><B>Parameters:</B><DD><CODE>type</CODE> - the key type for this map 639 <DT><B>Returns:</B><DD>a new, empty <code>EnumMap</code></DL> 640 </DD> 641 </DL> 642 <HR> 643 644 <A NAME="newEnumMap(java.util.Map)"><!-- --></A><H3> 645 newEnumMap</H3> 646 <PRE> 647 public static <K extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A><K>,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumMap.html?is-external=true" title="class or interface in java.util">EnumMap</A><K,V> <B>newEnumMap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,? extends V> map)</PRE> 648 <DL> 649 <DD>Creates an <code>EnumMap</code> with the same mappings as the specified map. 650 <P> 651 <DD><DL> 652 <DT><B>Parameters:</B><DD><CODE>map</CODE> - the map from which to initialize this <code>EnumMap</code> 653 <DT><B>Returns:</B><DD>a new <code>EnumMap</code> initialized with the mappings from <code>map</code> 654 <DT><B>Throws:</B> 655 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>m</code> is not an <code>EnumMap</code> 656 instance and contains no mappings</DL> 657 </DD> 658 </DL> 659 <HR> 660 661 <A NAME="newIdentityHashMap()"><!-- --></A><H3> 662 newIdentityHashMap</H3> 663 <PRE> 664 public static <K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/IdentityHashMap.html?is-external=true" title="class or interface in java.util">IdentityHashMap</A><K,V> <B>newIdentityHashMap</B>()</PRE> 665 <DL> 666 <DD>Creates an <code>IdentityHashMap</code> instance. 667 <P> 668 <DD><DL> 669 670 <DT><B>Returns:</B><DD>a new, empty <code>IdentityHashMap</code></DL> 671 </DD> 672 </DL> 673 <HR> 674 675 <A NAME="synchronizedBiMap(com.google.common.collect.BiMap)"><!-- --></A><H3> 676 synchronizedBiMap</H3> 677 <PRE> 678 public static <K,V> <A HREF="../../../../com/google/common/collect/BiMap.html" title="interface in com.google.common.collect">BiMap</A><K,V> <B>synchronizedBiMap</B>(<A HREF="../../../../com/google/common/collect/BiMap.html" title="interface in com.google.common.collect">BiMap</A><K,V> bimap)</PRE> 679 <DL> 680 <DD>Returns a synchronized (thread-safe) bimap backed by the specified bimap. 681 In order to guarantee serial access, it is critical that <b>all</b> access 682 to the backing bimap is accomplished through the returned bimap. 683 684 <p>It is imperative that the user manually synchronize on the returned map 685 when accessing any of its collection views: <pre> <code>BiMap<Long, String> map = Maps.synchronizedBiMap( 686 HashBiMap.<Long, String>create()); 687 ... 688 Set<Long> set = map.keySet(); // Needn't be in synchronized block 689 ... 690 synchronized (map) { // Synchronizing on map, not set! 691 Iterator<Long> it = set.iterator(); // Must be in synchronized block 692 while (it.hasNext()) { 693 foo(it.next()); 694 } 695 }</code></pre> 696 697 Failure to follow this advice may result in non-deterministic behavior. 698 699 <p>The returned bimap will be serializable if the specified bimap is 700 serializable. 701 <P> 702 <DD><DL> 703 <DT><B>Parameters:</B><DD><CODE>bimap</CODE> - the bimap to be wrapped in a synchronized view 704 <DT><B>Returns:</B><DD>a sychronized view of the specified bimap</DL> 705 </DD> 706 </DL> 707 <HR> 708 709 <A NAME="difference(java.util.Map, java.util.Map)"><!-- --></A><H3> 710 difference</H3> 711 <PRE> 712 public static <K,V> <A HREF="../../../../com/google/common/collect/MapDifference.html" title="interface in com.google.common.collect">MapDifference</A><K,V> <B>difference</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><? extends K,? extends V> left, 713 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><? extends K,? extends V> right)</PRE> 714 <DL> 715 <DD>Computes the difference between two maps. This difference is an immutable 716 snapshot of the state of the maps at the time this method is called. It 717 will never change, even if the maps change at a later time. 718 719 <p>Since this method uses <code>HashMap</code> instances internally, the keys of 720 the supplied maps must be well-behaved with respect to 721 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang"><CODE>Object.equals(java.lang.Object)</CODE></A> and <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang"><CODE>Object.hashCode()</CODE></A>. 722 723 <p><b>Note:</b>If you only need to know whether two maps have the same 724 mappings, call <code>left.equals(right)</code> instead of this method. 725 <P> 726 <DD><DL> 727 <DT><B>Parameters:</B><DD><CODE>left</CODE> - the map to treat as the "left" map for purposes of comparison<DD><CODE>right</CODE> - the map to treat as the "right" map for purposes of comparison 728 <DT><B>Returns:</B><DD>the difference between the two maps</DL> 729 </DD> 730 </DL> 731 <HR> 732 733 <A NAME="uniqueIndex(java.lang.Iterable, com.google.common.base.Function)"><!-- --></A><H3> 734 uniqueIndex</H3> 735 <PRE> 736 public static <K,V> <A HREF="../../../../com/google/common/collect/ImmutableMap.html" title="class in com.google.common.collect">ImmutableMap</A><K,V> <B>uniqueIndex</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><V> values, 737 <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><? super V,K> keyFunction)</PRE> 738 <DL> 739 <DD>Returns an immutable map for which the <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true#values()" title="class or interface in java.util"><CODE>Map.values()</CODE></A> are the given 740 elements in the given order, and each key is the product of invoking a 741 supplied function on its corresponding value. 742 <P> 743 <DD><DL> 744 <DT><B>Parameters:</B><DD><CODE>values</CODE> - the values to use when constructing the <code>Map</code><DD><CODE>keyFunction</CODE> - the function used to produce the key for each value 745 <DT><B>Returns:</B><DD>a map mapping the result of evaluating the function <code>keyFunction</code> on each value in the input collection to that value 746 <DT><B>Throws:</B> 747 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>keyFunction</code> produces the same 748 key for more than one value in the input collection 749 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if any elements of <code>values</code> is null, or 750 if <code>keyFunction</code> produces <code>null</code> for any value</DL> 751 </DD> 752 </DL> 753 <HR> 754 755 <A NAME="fromProperties(java.util.Properties)"><!-- --></A><H3> 756 fromProperties</H3> 757 <PRE> 758 public static <A HREF="../../../../com/google/common/collect/ImmutableMap.html" title="class in com.google.common.collect">ImmutableMap</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>,<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>> <B>fromProperties</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Properties.html?is-external=true" title="class or interface in java.util">Properties</A> properties)</PRE> 759 <DL> 760 <DD>Creates an <code>ImmutableMap<String, String></code> from a <code>Properties</code> 761 instance. Properties normally derive from <code>Map<Object, Object></code>, but 762 they typically contain strings, which is awkward. This method lets you get 763 a plain-old-<code>Map</code> out of a <code>Properties</code>. 764 <P> 765 <DD><DL> 766 <DT><B>Parameters:</B><DD><CODE>properties</CODE> - a <code>Properties</code> object to be converted 767 <DT><B>Returns:</B><DD>an immutable map containing all the entries in 768 <code>properties</code> 769 <DT><B>Throws:</B> 770 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if any key in <code>Properties</code> is not a 771 <code>String</code> 772 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if any key or value in <code>Properties</code> is 773 null.</DL> 774 </DD> 775 </DL> 776 <HR> 777 778 <A NAME="immutableEntry(java.lang.Object,java.lang.Object)"><!-- --></A><A NAME="immutableEntry(K, V)"><!-- --></A><H3> 779 immutableEntry</H3> 780 <PRE> 781 public static <K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true" title="class or interface in java.util">Map.Entry</A><K,V> <B>immutableEntry</B>(<FONT SIZE="-1"><A HREF="http://jsr-305.googlecode.com/svn/trunk/javadoc/javax/annotation/Nullable.html?is-external=true" title="class or interface in javax.annotation">@Nullable</A></FONT> 782 K key, 783 <FONT SIZE="-1"><A HREF="http://jsr-305.googlecode.com/svn/trunk/javadoc/javax/annotation/Nullable.html?is-external=true" title="class or interface in javax.annotation">@Nullable</A></FONT> 784 V value)</PRE> 785 <DL> 786 <DD>Returns an immutable map entry with the specified key and value. The <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true#setValue(V)" title="class or interface in java.util"><CODE>Map.Entry.setValue(V)</CODE></A> operation throws an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang"><CODE>UnsupportedOperationException</CODE></A>. 787 788 <p>The returned entry is serializable. 789 <P> 790 <DD><DL> 791 <DT><B>Parameters:</B><DD><CODE>key</CODE> - the key to be associated with the returned entry<DD><CODE>value</CODE> - the value to be associated with the returned entry</DL> 792 </DD> 793 </DL> 794 <HR> 795 796 <A NAME="unmodifiableBiMap(com.google.common.collect.BiMap)"><!-- --></A><H3> 797 unmodifiableBiMap</H3> 798 <PRE> 799 public static <K,V> <A HREF="../../../../com/google/common/collect/BiMap.html" title="interface in com.google.common.collect">BiMap</A><K,V> <B>unmodifiableBiMap</B>(<A HREF="../../../../com/google/common/collect/BiMap.html" title="interface in com.google.common.collect">BiMap</A><? extends K,? extends V> bimap)</PRE> 800 <DL> 801 <DD>Returns an unmodifiable view of the specified bimap. This method allows 802 modules to provide users with "read-only" access to internal bimaps. Query 803 operations on the returned bimap "read through" to the specified bimap, and 804 attemps to modify the returned map, whether direct or via its collection 805 views, result in an <code>UnsupportedOperationException</code>. 806 807 <p>The returned bimap will be serializable if the specified bimap is 808 serializable. 809 <P> 810 <DD><DL> 811 <DT><B>Parameters:</B><DD><CODE>bimap</CODE> - the bimap for which an unmodifiable view is to be returned 812 <DT><B>Returns:</B><DD>an unmodifiable view of the specified bimap</DL> 813 </DD> 814 </DL> 815 <HR> 816 817 <A NAME="transformValues(java.util.Map, com.google.common.base.Function)"><!-- --></A><H3> 818 transformValues</H3> 819 <PRE> 820 public static <K,V1,V2> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V2> <B>transformValues</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V1> fromMap, 821 <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><? super V1,V2> function)</PRE> 822 <DL> 823 <DD>Returns a view of a map where each value is transformed by a function. All 824 other properties of the map, such as iteration order, are left intact. For 825 example, the code: 826 <pre> <code>Map<String, Integer> map = ImmutableMap.of("a", 4, "b", 9); 827 Function<Integer, Double> sqrt = new Function<Integer, Double>() { 828 public Double apply(Integer in) { 829 return Math.sqrt((int) in); 830 } 831 }; 832 Map<String, Double> transformed = Maps.transformValues(sqrt, map); 833 System.out.println(transformed);</code></pre> 834 835 ... prints <code>{a=2.0, b=3.0}</code>. 836 837 <p>Changes in the underlying map are reflected in this view. Conversely, 838 this view supports removal operations, and these are reflected in the 839 underlying map. 840 841 <p>It's acceptable for the underlying map to contain null keys, and even 842 null values provided that the function is capable of accepting null input. 843 The transformed map might contain null values, if the function sometimes 844 gives a null result. 845 846 <p>The returned map is not thread-safe or serializable, even if the 847 underlying map is. 848 849 <p>The function is applied lazily, invoked when needed. This is necessary 850 for the returned map to be a view, but it means that the function will be 851 applied many times for bulk operations like <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true#containsValue(java.lang.Object)" title="class or interface in java.util"><CODE>Map.containsValue(java.lang.Object)</CODE></A> and 852 <code>Map.toString()</code>. For this to perform well, <code>function</code> should 853 be fast. To avoid lazy evaluation when the returned map doesn't need to be 854 a view, copy the returned map into a new map of your choosing. 855 <P> 856 <DD><DL> 857 </DL> 858 </DD> 859 </DL> 860 <HR> 861 862 <A NAME="filterKeys(java.util.Map, com.google.common.base.Predicate)"><!-- --></A><H3> 863 filterKeys</H3> 864 <PRE> 865 public static <K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V> <B>filterKeys</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V> unfiltered, 866 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super K> keyPredicate)</PRE> 867 <DL> 868 <DD>Returns a map containing the mappings in <code>unfiltered</code> whose keys 869 satisfy a predicate. The returned map is a live view of <code>unfiltered</code>; 870 changes to one affect the other. 871 872 <p>The resulting map's <code>keySet()</code>, <code>entrySet()</code>, and <code>values()</code> views have iterators that don't support <code>remove()</code>, but all 873 other methods are supported by the map and its views. The map's <code>put()</code> and <code>putAll()</code> methods throw an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang"><CODE>IllegalArgumentException</CODE></A> if a key that doesn't satisfy the predicate is 874 provided. 875 876 <p>When methods such as <code>removeAll()</code> and <code>clear()</code> are called 877 on the filtered map or its views, only mappings whose keys satisfy the 878 filter will be removed from the underlying map. 879 880 <p>The returned map isn't threadsafe or serializable, even if <code>unfiltered</code> is. 881 882 <p>Many of the filtered map's methods, such as <code>size()</code>, 883 iterate across every key/value mapping in the underlying map and determine 884 which satisfy the filter. When a live view is <i>not</i> needed, it may be 885 faster to copy the filtered map and use the copy. 886 <P> 887 <DD><DL> 888 </DL> 889 </DD> 890 </DL> 891 <HR> 892 893 <A NAME="filterValues(java.util.Map, com.google.common.base.Predicate)"><!-- --></A><H3> 894 filterValues</H3> 895 <PRE> 896 public static <K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V> <B>filterValues</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V> unfiltered, 897 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super V> valuePredicate)</PRE> 898 <DL> 899 <DD>Returns a map containing the mappings in <code>unfiltered</code> whose values 900 satisfy a predicate. The returned map is a live view of <code>unfiltered</code>; 901 changes to one affect the other. 902 903 <p>The resulting map's <code>keySet()</code>, <code>entrySet()</code>, and <code>values()</code> views have iterators that don't support <code>remove()</code>, but all 904 other methods are supported by the map and its views. The <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true#put(K, V)" title="class or interface in java.util"><CODE>Map.put(K, V)</CODE></A>, 905 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true#putAll(java.util.Map)" title="class or interface in java.util"><CODE>Map.putAll(java.util.Map<? extends K, ? extends V>)</CODE></A>, and <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true#setValue(V)" title="class or interface in java.util"><CODE>Map.Entry.setValue(V)</CODE></A> methods throw an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang"><CODE>IllegalArgumentException</CODE></A> if a value that doesn't satisfy the predicate is 906 provided. 907 908 <p>When methods such as <code>removeAll()</code> and <code>clear()</code> are called 909 on the filtered map or its views, only mappings whose values satisfy the 910 filter will be removed from the underlying map. 911 912 <p>The returned map isn't threadsafe or serializable, even if <code>unfiltered</code> is. 913 914 <p>Many of the filtered map's methods, such as <code>size()</code>, 915 iterate across every key/value mapping in the underlying map and determine 916 which satisfy the filter. When a live view is <i>not</i> needed, it may be 917 faster to copy the filtered map and use the copy. 918 <P> 919 <DD><DL> 920 </DL> 921 </DD> 922 </DL> 923 <HR> 924 925 <A NAME="filterEntries(java.util.Map, com.google.common.base.Predicate)"><!-- --></A><H3> 926 filterEntries</H3> 927 <PRE> 928 public static <K,V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V> <B>filterEntries</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,V> unfiltered, 929 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true" title="class or interface in java.util">Map.Entry</A><K,V>> entryPredicate)</PRE> 930 <DL> 931 <DD>Returns a map containing the mappings in <code>unfiltered</code> that satisfy a 932 predicate. The returned map is a live view of <code>unfiltered</code>; changes 933 to one affect the other. 934 935 <p>The resulting map's <code>keySet()</code>, <code>entrySet()</code>, and <code>values()</code> views have iterators that don't support <code>remove()</code>, but all 936 other methods are supported by the map and its views. The map's <code>put()</code> and <code>putAll()</code> methods throw an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang"><CODE>IllegalArgumentException</CODE></A> if a key/value pair that doesn't satisfy the 937 predicate is provided. Similarly, the map's entries have a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true#setValue(V)" title="class or interface in java.util"><CODE>Map.Entry.setValue(V)</CODE></A> method that throws an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang"><CODE>IllegalArgumentException</CODE></A> when 938 the existing key and the provided value don't satisfy the predicate. 939 940 <p>When methods such as <code>removeAll()</code> and <code>clear()</code> are called 941 on the filtered map or its views, only mappings that satisfy the filter 942 will be removed from the underlying map. 943 944 <p>The returned map isn't threadsafe or serializable, even if <code>unfiltered</code> is. 945 946 <p>Many of the filtered map's methods, such as <code>size()</code>, 947 iterate across every key/value mapping in the underlying map and determine 948 which satisfy the filter. When a live view is <i>not</i> needed, it may be 949 faster to copy the filtered map and use the copy. 950 <P> 951 <DD><DL> 952 </DL> 953 </DD> 954 </DL> 955 <!-- ========= END OF CLASS DATA ========= --> 956 <HR> 957 958 959 <!-- ======= START OF BOTTOM NAVBAR ====== --> 960 <A NAME="navbar_bottom"><!-- --></A> 961 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 962 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 963 <TR> 964 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 965 <A NAME="navbar_bottom_firstrow"><!-- --></A> 966 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 967 <TR ALIGN="center" VALIGN="top"> 968 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 969 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 970 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 971 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Maps.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 972 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 973 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 974 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 975 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 976 </TR> 977 </TABLE> 978 </TD> 979 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 980 </EM> 981 </TD> 982 </TR> 983 984 <TR> 985 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 986 <A HREF="../../../../com/google/common/collect/MapMaker.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A> 987 <A HREF="../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD> 988 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 989 <A HREF="../../../../index.html?com/google/common/collect/Maps.html" target="_top"><B>FRAMES</B></A> 990 <A HREF="Maps.html" target="_top"><B>NO FRAMES</B></A> 991 <SCRIPT type="text/javascript"> 992 <!-- 993 if(window==top) { 994 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 995 } 996 //--> 997 </SCRIPT> 998 <NOSCRIPT> 999 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 1000 </NOSCRIPT> 1001 1002 1003 </FONT></TD> 1004 </TR> 1005 <TR> 1006 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 1007 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 1008 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 1009 DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 1010 </TR> 1011 </TABLE> 1012 <A NAME="skip-navbar_bottom"></A> 1013 <!-- ======== END OF BOTTOM NAVBAR ======= --> 1014 1015 <HR> 1016 1017 </BODY> 1018 </HTML> 1019