Class Immutables
For example list(1, 2)
, map("key", "value")
, multimap(k1, v1, k2, v2)
etc.
These APIs are best static imported universally throughout a code base such that seeing
list(1, 2)
, map(k, v)
immediately tells the readers what they are. For new code base,
collection literals like list(1, 2)
are more concise than their longer equivalents like
ImmutableList.of(1, 2)
. For existing code base, either fully migrate the longer literals
or continue using them. Mixing the two styles can cause confusion.
Unlike JDK collection literals such as Map.of()
, collection literals returned by this class
don't lose the "Immutable" from the type. This allows you to use ImmutableMap
,
ImmutableList
as return types of public API, helping to make the contract unambiguous.
If you use Guava, we recommend continuing to use the immutable collection types and the
immutable collection literals in this class over JDK collection literals.
- Since:
- 6.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,
V> com.google.common.collect.ImmutableBiMap <K, V> biMap()
Deprecated.Returns the empty bimap.static <K,
V> com.google.common.collect.ImmutableBiMap <K, V> biMap
(K k1, V v1) Deprecated.Returns an immutable bimap containing a single entry.static <K,
V> com.google.common.collect.ImmutableBiMap <K, V> biMap
(K k1, V v1, K k2, V v2) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableBiMap <K, V> biMap
(K k1, V v1, K k2, V v2, K k3, V v3) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableBiMap <K, V> biMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableBiMap <K, V> biMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableBiMap <K, V> biMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableBiMap <K, V> biMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableBiMap <K, V> biMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableBiMap <K, V> biMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableBiMap <K, V> biMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) Deprecated.Returns an immutable map containing the given entries, in order.static <E> com.google.common.collect.ImmutableList
<E> list()
Deprecated.Returns the empty immutable list.static <E> com.google.common.collect.ImmutableList
<E> list
(E element) Deprecated.Returns an immutable list containing a single element.static <E> com.google.common.collect.ImmutableList
<E> list
(E e1, E e2) Deprecated.Returns an immutable list containing the given elements, in order.static <E> com.google.common.collect.ImmutableList
<E> list
(E e1, E e2, E e3) Deprecated.Returns an immutable list containing the given elements, in order.static <E> com.google.common.collect.ImmutableList
<E> list
(E e1, E e2, E e3, E e4) Deprecated.Returns an immutable list containing the given elements, in order.static <E> com.google.common.collect.ImmutableList
<E> list
(E e1, E e2, E e3, E e4, E e5) Deprecated.Returns an immutable list containing the given elements, in order.static <E> com.google.common.collect.ImmutableList
<E> list
(E e1, E e2, E e3, E e4, E e5, E e6) Deprecated.Returns an immutable list containing the given elements, in order.static <E> com.google.common.collect.ImmutableList
<E> list
(E e1, E e2, E e3, E e4, E e5, E e6, E e7) Deprecated.Returns an immutable list containing the given elements, in order.static <E> com.google.common.collect.ImmutableList
<E> list
(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) Deprecated.Returns an immutable list containing the given elements, in order.static <E> com.google.common.collect.ImmutableList
<E> list
(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) Deprecated.Returns an immutable list containing the given elements, in order.static <E> com.google.common.collect.ImmutableList
<E> list
(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) Deprecated.Returns an immutable list containing the given elements, in order.static <E> com.google.common.collect.ImmutableList
<E> list
(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11) Deprecated.Returns an immutable list containing the given elements, in order.static <E> com.google.common.collect.ImmutableList
<E> list
(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12, E... others) Deprecated.Returns an immutable list containing the given elements, in order.static <K,
V> com.google.common.collect.ImmutableMap <K, V> map()
Deprecated.Returns the empty map.static <K,
V> com.google.common.collect.ImmutableMap <K, V> map
(K k1, V v1) Deprecated.Returns an immutable map containing a single entry.static <K,
V> com.google.common.collect.ImmutableMap <K, V> map
(K k1, V v1, K k2, V v2) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableMap <K, V> map
(K k1, V v1, K k2, V v2, K k3, V v3) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableMap <K, V> map
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableMap <K, V> map
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableMap <K, V> map
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableMap <K, V> map
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableMap <K, V> map
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableMap <K, V> map
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableMap <K, V> map
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) Deprecated.Returns an immutable map containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableListMultimap <K, V> multimap()
Deprecated.Returns the empty multimap.static <K,
V> com.google.common.collect.ImmutableListMultimap <K, V> multimap
(K k1, V v1) Deprecated.Returns an immutable multimap containing a single entry.static <K,
V> com.google.common.collect.ImmutableListMultimap <K, V> multimap
(K k1, V v1, K k2, V v2) Deprecated.Returns an immutable multimap containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableListMultimap <K, V> multimap
(K k1, V v1, K k2, V v2, K k3, V v3) Deprecated.Returns an immutable multimap containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableListMultimap <K, V> multimap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Deprecated.Returns an immutable multimap containing the given entries, in order.static <K,
V> com.google.common.collect.ImmutableListMultimap <K, V> multimap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Deprecated.Returns an immutable multimap containing the given entries, in order.static <E> com.google.common.collect.ImmutableMultiset
<E> multiset()
Deprecated.Returns the empty immutable multiset.static <E> com.google.common.collect.ImmutableMultiset
<E> multiset
(E element) Deprecated.Returns an immutable multiset containing a single element.static <E> com.google.common.collect.ImmutableMultiset
<E> multiset
(E e1, E e2) Deprecated.Returns an immutable multiset containing the given elements, in order.static <E> com.google.common.collect.ImmutableMultiset
<E> multiset
(E e1, E e2, E e3) Deprecated.Returns an immutable multiset containing the given elements, in the "grouped iteration order" described in the class documentation.static <E> com.google.common.collect.ImmutableMultiset
<E> multiset
(E e1, E e2, E e3, E e4) Deprecated.Returns an immutable multiset containing the given elements, in the "grouped iteration order" described in the class documentation.static <E> com.google.common.collect.ImmutableMultiset
<E> multiset
(E e1, E e2, E e3, E e4, E e5) Deprecated.Returns an immutable multiset containing the given elements, in the "grouped iteration order" described in the class documentation.static <E> com.google.common.collect.ImmutableMultiset
<E> multiset
(E e1, E e2, E e3, E e4, E e5, E e6, E... others) Deprecated.Returns an immutable multiset containing the given elements, in the "grouped iteration order" described in the class documentation.static <E> com.google.common.collect.ImmutableSet
<E> set()
Deprecated.Returns the empty immutable set.static <E> com.google.common.collect.ImmutableSet
<E> set
(E element) Deprecated.Returns an immutable set containingelement
.static <E> com.google.common.collect.ImmutableSet
<E> set
(E e1, E e2) Deprecated.Returns an immutable set containing the given elements, minus duplicates, in the order each was first specified.static <E> com.google.common.collect.ImmutableSet
<E> set
(E e1, E e2, E e3) Deprecated.Returns an immutable set containing the given elements, minus duplicates, in the order each was first specified.static <E> com.google.common.collect.ImmutableSet
<E> set
(E e1, E e2, E e3, E e4) Deprecated.Returns an immutable set containing the given elements, minus duplicates, in the order each was first specified.static <E> com.google.common.collect.ImmutableSet
<E> set
(E e1, E e2, E e3, E e4, E e5) Deprecated.Returns an immutable set containing the given elements, minus duplicates, in the order each was first specified.static <E> com.google.common.collect.ImmutableSet
<E> set
(E e1, E e2, E e3, E e4, E e5, E e6, E... others) Deprecated.Returns an immutable set containing the given elements, minus duplicates, in the order each was first specified.static <K,
V> com.google.common.collect.ImmutableSortedMap <K, V> Deprecated.Returns the empty sorted map.static <K extends Comparable<? super K>,
V>
com.google.common.collect.ImmutableSortedMap<K, V> sortedMap
(K k1, V v1) Deprecated.Returns an immutable map containing a single entry.static <K extends Comparable<? super K>,
V>
com.google.common.collect.ImmutableSortedMap<K, V> sortedMap
(K k1, V v1, K k2, V v2) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
com.google.common.collect.ImmutableSortedMap<K, V> sortedMap
(K k1, V v1, K k2, V v2, K k3, V v3) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
com.google.common.collect.ImmutableSortedMap<K, V> sortedMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
com.google.common.collect.ImmutableSortedMap<K, V> sortedMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
com.google.common.collect.ImmutableSortedMap<K, V> sortedMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
com.google.common.collect.ImmutableSortedMap<K, V> sortedMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
com.google.common.collect.ImmutableSortedMap<K, V> sortedMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
com.google.common.collect.ImmutableSortedMap<K, V> sortedMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
com.google.common.collect.ImmutableSortedMap<K, V> sortedMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <R,
C, V> com.google.common.collect.ImmutableTable <R, C, V> table()
Deprecated.Returns an empty immutable table.static <R,
C, V> com.google.common.collect.ImmutableTable <R, C, V> table
(R r, C c, V v) Deprecated.Returns an immutable table containing a single cell.static <R,
C, V> com.google.common.collect.ImmutableTable <R, C, V> table
(R r1, C c1, V v1, R r2, C c2, V v2) Deprecated.Returns an immutable table containing two cells.
-
Method Details
-
list
public static <E> com.google.common.collect.ImmutableList<E> list()Deprecated.Returns the empty immutable list. This list behaves and performs comparably toCollections.emptyList()
, and is preferable mainly for consistency and maintainability set your code.Performance note: the instance returned is a singleton.
-
list
public static <E> com.google.common.collect.ImmutableList<E> list(E element) Deprecated.Returns an immutable list containing a single element. This list behaves and performs comparably toCollections.singletonList(T)
, but will not accept a null element. It is preferable mainly for consistency and maintainability list your code.- Throws:
NullPointerException
- ifelement
is null
-
list
public static <E> com.google.common.collect.ImmutableList<E> list(E e1, E e2) Deprecated.Returns an immutable list containing the given elements, in order.- Throws:
NullPointerException
- if any element is null
-
list
public static <E> com.google.common.collect.ImmutableList<E> list(E e1, E e2, E e3) Deprecated.Returns an immutable list containing the given elements, in order.- Throws:
NullPointerException
- if any element is null
-
list
public static <E> com.google.common.collect.ImmutableList<E> list(E e1, E e2, E e3, E e4) Deprecated.Returns an immutable list containing the given elements, in order.- Throws:
NullPointerException
- if any element is null
-
list
public static <E> com.google.common.collect.ImmutableList<E> list(E e1, E e2, E e3, E e4, E e5) Deprecated.Returns an immutable list containing the given elements, in order.- Throws:
NullPointerException
- if any element is null
-
list
public static <E> com.google.common.collect.ImmutableList<E> list(E e1, E e2, E e3, E e4, E e5, E e6) Deprecated.Returns an immutable list containing the given elements, in order.- Throws:
NullPointerException
- if any element is null
-
list
public static <E> com.google.common.collect.ImmutableList<E> list(E e1, E e2, E e3, E e4, E e5, E e6, E e7) Deprecated.Returns an immutable list containing the given elements, in order.- Throws:
NullPointerException
- if any element is null
-
list
public static <E> com.google.common.collect.ImmutableList<E> list(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) Deprecated.Returns an immutable list containing the given elements, in order.- Throws:
NullPointerException
- if any element is null
-
list
public static <E> com.google.common.collect.ImmutableList<E> list(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) Deprecated.Returns an immutable list containing the given elements, in order.- Throws:
NullPointerException
- if any element is null
-
list
public static <E> com.google.common.collect.ImmutableList<E> list(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) Deprecated.Returns an immutable list containing the given elements, in order.- Throws:
NullPointerException
- if any element is null
-
list
public static <E> com.google.common.collect.ImmutableList<E> list(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11) Deprecated.Returns an immutable list containing the given elements, in order.- Throws:
NullPointerException
- if any element is null
-
list
@SafeVarargs public static <E> com.google.common.collect.ImmutableList<E> list(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12, E... others) Deprecated.Returns an immutable list containing the given elements, in order.The array
others
must not be longer thanInteger.MAX_VALUE - 12
.- Throws:
NullPointerException
- if any element is null
-
set
public static <E> com.google.common.collect.ImmutableSet<E> set()Deprecated.Returns the empty immutable set. Preferred overCollections.emptySet()
for code consistency, and because the return type conveys the immutability guarantee.Performance note: the instance returned is a singleton.
-
set
public static <E> com.google.common.collect.ImmutableSet<E> set(E element) Deprecated.Returns an immutable set containingelement
. Preferred overCollections.singleton(T)
for code consistency,null
rejection, and because the return type conveys the immutability guarantee. -
set
public static <E> com.google.common.collect.ImmutableSet<E> set(E e1, E e2) Deprecated.Returns an immutable set containing the given elements, minus duplicates, in the order each was first specified. That is, if multiple elements are equal, all except the first are ignored. -
set
public static <E> com.google.common.collect.ImmutableSet<E> set(E e1, E e2, E e3) Deprecated.Returns an immutable set containing the given elements, minus duplicates, in the order each was first specified. That is, if multiple elements are equal, all except the first are ignored. -
set
public static <E> com.google.common.collect.ImmutableSet<E> set(E e1, E e2, E e3, E e4) Deprecated.Returns an immutable set containing the given elements, minus duplicates, in the order each was first specified. That is, if multiple elements are equal, all except the first are ignored. -
set
public static <E> com.google.common.collect.ImmutableSet<E> set(E e1, E e2, E e3, E e4, E e5) Deprecated.Returns an immutable set containing the given elements, minus duplicates, in the order each was first specified. That is, if multiple elements are equal, all except the first are ignored. -
set
@SafeVarargs public static <E> com.google.common.collect.ImmutableSet<E> set(E e1, E e2, E e3, E e4, E e5, E e6, E... others) Deprecated.Returns an immutable set containing the given elements, minus duplicates, in the order each was first specified. That is, if multiple elements are equal, all except the first are ignored.The array
others
must not be longer thanInteger.MAX_VALUE - 6
. -
map
public static <K,V> com.google.common.collect.ImmutableMap<K,V> map()Deprecated.Returns the empty map. This map behaves and performs comparably toCollections.emptyMap()
, and is preferable mainly for consistency and maintainability of your code.Performance note: the instance returned is a singleton.
-
map
public static <K,V> com.google.common.collect.ImmutableMap<K,V> map(K k1, V v1) Deprecated.Returns an immutable map containing a single entry. This map behaves and performs comparably toCollections.singletonMap(K, V)
but will not accept a null key or value. It is preferable mainly for consistency and maintainability of your code. -
map
public static <K,V> com.google.common.collect.ImmutableMap<K,V> map(K k1, V v1, K k2, V v2) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys are provided
-
map
public static <K,V> com.google.common.collect.ImmutableMap<K,V> map(K k1, V v1, K k2, V v2, K k3, V v3) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys are provided
-
map
public static <K,V> com.google.common.collect.ImmutableMap<K,V> map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys are provided
-
map
public static <K,V> com.google.common.collect.ImmutableMap<K,V> map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys are provided
-
map
public static <K,V> com.google.common.collect.ImmutableMap<K,V> map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys are provided
-
map
public static <K,V> com.google.common.collect.ImmutableMap<K,V> map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys are provided
-
map
public static <K,V> com.google.common.collect.ImmutableMap<K,V> map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys are provided
-
map
public static <K,V> com.google.common.collect.ImmutableMap<K,V> map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys are provided
-
map
public static <K,V> com.google.common.collect.ImmutableMap<K,V> map(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys are provided
-
sortedMap
public static <K,V> com.google.common.collect.ImmutableSortedMap<K,V> sortedMap()Deprecated.Returns the empty sorted map.Performance note: the instance returned is a singleton.
-
sortedMap
public static <K extends Comparable<? super K>,V> com.google.common.collect.ImmutableSortedMap<K,V> sortedMap(K k1, V v1) Deprecated.Returns an immutable map containing a single entry. -
sortedMap
public static <K extends Comparable<? super K>,V> com.google.common.collect.ImmutableSortedMap<K,V> sortedMap(K k1, V v1, K k2, V v2) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if the two keys are equal according to their natural ordering
-
sortedMap
public static <K extends Comparable<? super K>,V> com.google.common.collect.ImmutableSortedMap<K,V> sortedMap(K k1, V v1, K k2, V v2, K k3, V v3) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering
-
sortedMap
public static <K extends Comparable<? super K>,V> com.google.common.collect.ImmutableSortedMap<K,V> sortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering
-
sortedMap
public static <K extends Comparable<? super K>,V> com.google.common.collect.ImmutableSortedMap<K,V> sortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering
-
sortedMap
public static <K extends Comparable<? super K>,V> com.google.common.collect.ImmutableSortedMap<K,V> sortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering
-
sortedMap
public static <K extends Comparable<? super K>,V> com.google.common.collect.ImmutableSortedMap<K,V> sortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering
-
sortedMap
public static <K extends Comparable<? super K>,V> com.google.common.collect.ImmutableSortedMap<K,V> sortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering
-
sortedMap
public static <K extends Comparable<? super K>,V> com.google.common.collect.ImmutableSortedMap<K,V> sortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering
-
sortedMap
public static <K extends Comparable<? super K>,V> com.google.common.collect.ImmutableSortedMap<K,V> sortedMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) Deprecated.Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering
-
multimap
public static <K,V> com.google.common.collect.ImmutableListMultimap<K,V> multimap()Deprecated.Returns the empty multimap.Performance note: the instance returned is a singleton.
-
multimap
public static <K,V> com.google.common.collect.ImmutableListMultimap<K,V> multimap(K k1, V v1) Deprecated.Returns an immutable multimap containing a single entry. -
multimap
public static <K,V> com.google.common.collect.ImmutableListMultimap<K,V> multimap(K k1, V v1, K k2, V v2) Deprecated.Returns an immutable multimap containing the given entries, in order. -
multimap
public static <K,V> com.google.common.collect.ImmutableListMultimap<K,V> multimap(K k1, V v1, K k2, V v2, K k3, V v3) Deprecated.Returns an immutable multimap containing the given entries, in order. -
multimap
public static <K,V> com.google.common.collect.ImmutableListMultimap<K,V> multimap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Deprecated.Returns an immutable multimap containing the given entries, in order. -
multimap
public static <K,V> com.google.common.collect.ImmutableListMultimap<K,V> multimap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Deprecated.Returns an immutable multimap containing the given entries, in order. -
multiset
public static <E> com.google.common.collect.ImmutableMultiset<E> multiset()Deprecated.Returns the empty immutable multiset.Performance note: the instance returned is a singleton.
-
multiset
public static <E> com.google.common.collect.ImmutableMultiset<E> multiset(E element) Deprecated.Returns an immutable multiset containing a single element.- Throws:
NullPointerException
- ifelement
is null
-
multiset
public static <E> com.google.common.collect.ImmutableMultiset<E> multiset(E e1, E e2) Deprecated.Returns an immutable multiset containing the given elements, in order.- Throws:
NullPointerException
- if any element is null
-
multiset
public static <E> com.google.common.collect.ImmutableMultiset<E> multiset(E e1, E e2, E e3) Deprecated.Returns an immutable multiset containing the given elements, in the "grouped iteration order" described in the class documentation.- Throws:
NullPointerException
- if any element is null
-
multiset
public static <E> com.google.common.collect.ImmutableMultiset<E> multiset(E e1, E e2, E e3, E e4) Deprecated.Returns an immutable multiset containing the given elements, in the "grouped iteration order" described in the class documentation.- Throws:
NullPointerException
- if any element is null
-
multiset
public static <E> com.google.common.collect.ImmutableMultiset<E> multiset(E e1, E e2, E e3, E e4, E e5) Deprecated.Returns an immutable multiset containing the given elements, in the "grouped iteration order" described in the class documentation.- Throws:
NullPointerException
- if any element is null
-
multiset
@SafeVarargs public static <E> com.google.common.collect.ImmutableMultiset<E> multiset(E e1, E e2, E e3, E e4, E e5, E e6, E... others) Deprecated.Returns an immutable multiset containing the given elements, in the "grouped iteration order" described in the class documentation.- Throws:
NullPointerException
- if any element is null
-
biMap
public static <K,V> com.google.common.collect.ImmutableBiMap<K,V> biMap()Deprecated.Returns the empty bimap.Performance note: the instance returned is a singleton.
-
biMap
public static <K,V> com.google.common.collect.ImmutableBiMap<K,V> biMap(K k1, V v1) Deprecated.Returns an immutable bimap containing a single entry. -
biMap
public static <K,V> com.google.common.collect.ImmutableBiMap<K,V> biMap(K k1, V v1, K k2, V v2) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys or values are added
-
biMap
public static <K,V> com.google.common.collect.ImmutableBiMap<K,V> biMap(K k1, V v1, K k2, V v2, K k3, V v3) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys or values are added
-
biMap
public static <K,V> com.google.common.collect.ImmutableBiMap<K,V> biMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys or values are added
-
biMap
public static <K,V> com.google.common.collect.ImmutableBiMap<K,V> biMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys or values are added
-
biMap
public static <K,V> com.google.common.collect.ImmutableBiMap<K,V> biMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys or values are added
-
biMap
public static <K,V> com.google.common.collect.ImmutableBiMap<K,V> biMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys or values are added
-
biMap
public static <K,V> com.google.common.collect.ImmutableBiMap<K,V> biMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys or values are added
-
biMap
public static <K,V> com.google.common.collect.ImmutableBiMap<K,V> biMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys or values are added
-
biMap
public static <K,V> com.google.common.collect.ImmutableBiMap<K,V> biMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) Deprecated.Returns an immutable map containing the given entries, in order.- Throws:
IllegalArgumentException
- if duplicate keys or values are added
-
table
public static <R,C, com.google.common.collect.ImmutableTable<R,V> C, table()V> Deprecated.Returns an empty immutable table.Performance note: the instance returned is a singleton.
-
table
public static <R,C, com.google.common.collect.ImmutableTable<R,V> C, tableV> (R r, C c, V v) Deprecated.Returns an immutable table containing a single cell. -
table
public static <R,C, com.google.common.collect.ImmutableTable<R,V> C, tableV> (R r1, C c1, V v1, R r2, C c2, V v2) Deprecated.Returns an immutable table containing two cells.
-