java.lang.Object
com.github.ushiosan23.jvm.collections.Containers
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> @UnmodifiableView @NotNull Map.Entry<K, V> entry(K key, V value) Generate an immutable map entry with the selected information.static <T> @NotNull @Unmodifiable List<T>listOf(T... items) Create an immutable list with all the given elements.static <K,V> @UnmodifiableView @NotNull Map<K, V> Generate an immutable map with all elements inside.mutableEntry(K key, V value) Generate a mutable map entry with the selected information.mutableListOf(T... items) Create a mutable list with all the given elements.mutableMapOf(Map.Entry<K, V> @NotNull ... elements) Generate a mutable map with all elements inside.mutableSetOf(T... items) Create a mutable set with all the given elements.static <T> @Unmodifiable @NotNull Set<T>setOf(T... items) Create an immutable set with all the given elements.
-
Method Details
-
listOf
@SafeVarargs @Contract(pure=true) @NotNull public static <T> @NotNull @Unmodifiable List<T> listOf(T... items) Create an immutable list with all the given elements.- Type Parameters:
T- List generic type- Parameters:
items- Elements to insert- Returns:
- Return an immutable list with all elements
-
mutableListOf
@SafeVarargs @Contract("_ -> new") @NotNull public static <T> @NotNull List<T> mutableListOf(T... items) Create a mutable list with all the given elements.- Type Parameters:
T- List generic type- Parameters:
items- Elements to insert- Returns:
- Return a mutable list with all elements
-
setOf
Create an immutable set with all the given elements.- Type Parameters:
T- Set generic type- Parameters:
items- Elements to insert- Returns:
- Return an immutable set with all elements
-
mutableSetOf
@SafeVarargs @Contract("_ -> new") @NotNull public static <T> @NotNull Set<T> mutableSetOf(T... items) Create a mutable set with all the given elements.- Type Parameters:
T- Set generic type- Parameters:
items- Elements to insert- Returns:
- Return a mutable set with all elements
-
mapOf
@SafeVarargs @NotNull public static <K,V> @UnmodifiableView @NotNull Map<K,V> mapOf(Map.Entry<K, V>... elements) Generate an immutable map with all elements inside.- Type Parameters:
K- Generic key typeV- Generic value type- Parameters:
elements- Target elements to insert- Returns:
- Returns an immutable map with all elements
-
mutableMapOf
@Contract(pure=true) @SafeVarargs @NotNull public static <K,V> @NotNull Map<K,V> mutableMapOf(Map.Entry<K, V> @NotNull ... elements) Generate a mutable map with all elements inside.- Type Parameters:
K- Generic key typeV- Generic value type- Parameters:
elements- Target elements to insert- Returns:
- Returns a mutable map with all elements
-
entry
@Contract(value="_, _ -> new", pure=true) public static <K,V> @UnmodifiableView @NotNull Map.Entry<K,V> entry(K key, V value) Generate an immutable map entry with the selected information.- Type Parameters:
K- Generic key typeV- Generic value type- Parameters:
key- The key to the map entryvalue- The value to the map entry- Returns:
- Returns a valid map entry with the selected information
-
mutableEntry
@Contract(value="_, _ -> new", pure=true) public static <K,V> @NotNull Map.Entry<K,V> mutableEntry(K key, V value) Generate a mutable map entry with the selected information.- Type Parameters:
K- Generic key typeV- Generic value type- Parameters:
key- The key to the map entryvalue- The value to the map entry- Returns:
- Returns a valid map entry with the selected information
-