Class RowKeyTable<R,C,V>

java.lang.Object
org.miaixz.bus.core.center.map.multi.AbstractTable<R,C,V>
org.miaixz.bus.core.center.map.multi.RowKeyTable<R,C,V>
Type Parameters:
R - 行类型
C - 列类型
V - 值类型
All Implemented Interfaces:
Iterable<Table.Cell<R,C,V>>, Table<R,C,V>

public class RowKeyTable<R,C,V> extends AbstractTable<R,C,V>
将行的键作为主键的Table实现 此结构为: 行=(列=值)
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • RowKeyTable

      public RowKeyTable()
      构造
    • RowKeyTable

      public RowKeyTable(boolean isLinked)
      构造
      Parameters:
      isLinked - 是否有序,有序则使用LinkedHashMap作为原始Map
    • RowKeyTable

      public RowKeyTable(Map<R,Map<C,V>> raw)
      构造
      Parameters:
      raw - 原始Map
    • RowKeyTable

      public RowKeyTable(Map<R,Map<C,V>> raw, Builder<? extends Map<C,V>> columnMapBuilder)
      构造
      Parameters:
      raw - 原始Map
      columnMapBuilder - 列的map创建器
  • Method Details

    • rowMap

      public Map<R,Map<C,V>> rowMap()
      Description copied from interface: Table
      返回行列对应的Map
      Returns:
      map,键为行键,值为列和值的对应map
    • put

      public V put(R rowKey, C columnKey, V value)
      Description copied from interface: Table
      为表格指定行列赋值,如果不存在,创建之,存在则替换之,返回原值
      Parameters:
      rowKey - 行键
      columnKey - 列键
      value - 值
      Returns:
      原值,不存在返回null
    • remove

      public V remove(R rowKey, C columnKey)
      Description copied from interface: Table
      移除指定值
      Parameters:
      rowKey - 行键
      columnKey - 列键
      Returns:
      移除的值,如果值不存在,返回null
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Table
      表格是否为空
      Returns:
      是否为空
    • clear

      public void clear()
      Description copied from interface: Table
      清空表格
    • containsColumn

      public boolean containsColumn(C columnKey)
      Description copied from interface: Table
      列是否存在
      Parameters:
      columnKey - 列键
      Returns:
      列是否存在
    • columnMap

      public Map<C,Map<R,V>> columnMap()
      Description copied from interface: Table
      返回列-行对应的map
      Returns:
      map,键为列键,值为行和值的对应map
    • columnKeySet

      public Set<C> columnKeySet()
      Description copied from interface: Table
      返回所有列的key,列的key不可重复
      Returns:
      列set
    • columnKeys

      public List<C> columnKeys()
      Description copied from interface: Table
      返回所有列的key,列的key如果实现Map是可重复key,则返回对应不去重的List。
      Returns:
      列set
    • getColumn

      public Map<R,V> getColumn(C columnKey)
      Description copied from interface: Table
      获取列
      Parameters:
      columnKey - 列键
      Returns:
      列映射,返回的键为行键,值为表格的值