Class OpenCollections.MapBuilder<K,V>
java.lang.Object
cloud.opencode.base.core.collect.OpenCollections.MapBuilder<K,V>
- Type Parameters:
K- the key type / 键类型V- the value type / 值类型
- Enclosing class:
OpenCollections
A builder for creating unmodifiable maps incrementally.
用于增量创建不可修改映射的构建器。
- Since:
- JDK 25, opencode-base-core V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and returns an unmodifiable map containing all added entries.Puts a key-value pair into this builder.Puts all entries from the given map into this builder.
-
Method Details
-
put
Puts a key-value pair into this builder. 向此构建器添加键值对。- Parameters:
key- the key (must not be null) / 键(不可为 null)value- the value (must not be null) / 值(不可为 null)- Returns:
- this builder / 此构建器
- Throws:
NullPointerException- if key or value is null / 如果 key 或 value 为 null
-
putAll
Puts all entries from the given map into this builder. 将给定映射的所有条目添加到此构建器。- Parameters:
map- the map whose entries to add (must not be null, no null keys or values) / 要添加条目的映射(不可为 null,键和值不可为 null)- Returns:
- this builder / 此构建器
- Throws:
NullPointerException- if map, any key, or any value is null / 如果 map、任何键或任何值为 null
-
build
-