public abstract class CollectionsHelper
extends java.lang.Object
Modifier and Type | Method | Description |
---|---|---|
static <T> java.util.List<T> |
listOf() |
Returns an immutable list containing zero elements.
|
static <T> java.util.List<T> |
listOf(T... elts) |
Returns an unmodifiable list containing the given elements.
|
static <K,V> java.util.Map.Entry<K,V> |
mapEntry(K k,
V v) |
Returns an
Map.Entry containing the given key and value. |
static <K,V> java.util.Map<K,V> |
mapOf() |
Returns an immutable map containing zero mappings.
|
static <K,V> java.util.Map<K,V> |
mapOf(K k1,
V v1) |
Create an unmodifiable map containing a single mappings.
|
static <K,V> java.util.Map<K,V> |
mapOf(K k1,
V v1,
K k2,
V v2) |
Create an unmodifiable map containing 2 mappings.
|
static <K,V> java.util.Map<K,V> |
mapOf(K k1,
V v1,
K k2,
V v2,
K k3,
V v3) |
Create an unmodifiable map containing 3 mappings.
|
static <K,V> java.util.Map<K,V> |
mapOf(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4) |
Create an unmodifiable map containing 4 mappings.
|
static <K,V> java.util.Map<K,V> |
mapOf(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5) |
Create an unmodifiable map containing 5 mappings.
|
static <K,V> java.util.Map<K,V> |
mapOf(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5,
K k6,
V v6) |
Create an unmodifiable map containing 5 mappings.
|
static <K,V> java.util.Map<K,V> |
mapOf(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) |
Create an unmodifiable map containing 5 mappings.
|
static <T> java.util.Set<T> |
setOf() |
Returns an immutable set containing zero elements.
|
static <T> java.util.Set<T> |
setOf(T... elts) |
Create an unmodifiable set containing the given elements.
|
public static <T> java.util.List<T> listOf()
T
- the List
's element typeList
@SafeVarargs public static <T> java.util.List<T> listOf(T... elts)
T
- the List
's element typeelts
- the elementsList
containing the specified elementspublic static <T> java.util.Set<T> setOf()
T
- the Set
's element typeSet
@SafeVarargs public static <T> java.util.Set<T> setOf(T... elts)
T
- the Set
's element typeelts
- elements to addSet
containing the specified elementspublic static <K,V> java.util.Map.Entry<K,V> mapEntry(K k, V v)
Map.Entry
containing the given key and value.K
- the key's typeV
- the value's typek
- keyv
- valueEntry
containing the specified key and valuepublic static <K,V> java.util.Map<K,V> mapOf()
K
- the Map
's key typeV
- the Map
's value typeMap
public static <K,V> java.util.Map<K,V> mapOf(K k1, V v1)
K
- the Map
's key typeV
- the Map
's value typek1
- keyv1
- valueMap
containing the specified mappingspublic static <K,V> java.util.Map<K,V> mapOf(K k1, V v1, K k2, V v2)
K
- the Map
's key typeV
- the Map
's value typek1
- first keyv1
- first valuek2
- second keyv2
- second valueMap
containing the specified mappingspublic static <K,V> java.util.Map<K,V> mapOf(K k1, V v1, K k2, V v2, K k3, V v3)
K
- the Map
's key typeV
- the Map
's value typek1
- first keyv1
- first valuek2
- second keyv2
- second valuek3
- third keyv3
- third valueMap
containing the specified mappingspublic static <K,V> java.util.Map<K,V> mapOf(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
K
- the Map
's key typeV
- the Map
's value typek1
- first keyv1
- first valuek2
- second keyv2
- second valuek3
- third keyv3
- third valuek4
- fourth keyv4
- fourth valueMap
containing the specified mappingspublic static <K,V> java.util.Map<K,V> mapOf(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
K
- the Map
's key typeV
- the Map
's value typek1
- first keyv1
- first valuek2
- second keyv2
- second valuek3
- third keyv3
- third valuek4
- fourth keyv4
- fourth valuek5
- fifth keyv5
- fifth valueMap
containing the specified mappingspublic static <K,V> java.util.Map<K,V> mapOf(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
- the Map
's key typeV
- the Map
's value typek1
- first keyv1
- first valuek2
- second keyv2
- second valuek3
- third keyv3
- third valuek4
- fourth keyv4
- fourth valuek5
- fifth keyv5
- fifth valuek6
- sixth keyv6
- sixth valueMap
containing the specified mappingspublic static <K,V> java.util.Map<K,V> mapOf(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
- the Map
's key typeV
- the Map
's value typek1
- first keyv1
- first valuek2
- second keyv2
- second valuek3
- third keyv3
- third valuek4
- fourth keyv4
- fourth valuek5
- fifth keyv5
- fifth valuek6
- sixth keyv6
- sixth valuek7
- seventh keyv7
- seventh valueMap
containing the specified mappingsCopyright © 2018 Oracle Corporation. All rights reserved.