Class ImmutableBiMap.Builder<K,V>

java.lang.Object
cloud.opencode.base.collections.immutable.ImmutableBiMap.Builder<K,V>
Type Parameters:
K - key type | 键类型
V - value type | 值类型
Enclosing class:
ImmutableBiMap<K,V>

public static final class ImmutableBiMap.Builder<K,V> extends Object
Builder for ImmutableBiMap ImmutableBiMap 构建器
Since:
JDK 25, opencode-base-collections V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • put

      public ImmutableBiMap.Builder<K,V> put(K key, V value)
      Add an entry. 添加条目。
      Parameters:
      key - the key | 键
      value - the value | 值
      Returns:
      this builder | 此构建器
      Throws:
      OpenCollectionException - if key or value already exists | 如果键或值已存在
    • putAll

      public ImmutableBiMap.Builder<K,V> putAll(Map<? extends K, ? extends V> map)
      Add all entries from a map. 从映射添加所有条目。
      Parameters:
      map - the map | 映射
      Returns:
      this builder | 此构建器
      Throws:
      OpenCollectionException - if duplicate keys or values are found | 如果找到重复的键或值
    • build

      public ImmutableBiMap<K,V> build()
      Build the immutable bimap. 构建不可变双向映射。
      Returns:
      immutable bimap | 不可变双向映射