Class CountMap<K>

java.lang.Object
cool.scx.common.count_map.CountMap<K>
Type Parameters:
K - Key
All Implemented Interfaces:
ICountMap<K>, Iterable<Map.Entry<K,Long>>

public class CountMap<K> extends Object implements ICountMap<K>
CountMap
Version:
0.0.1
Author:
scx567888
  • Constructor Details

  • Method Details

    • add

      public long add(K key, long count)
      Description copied from interface: ICountMap
      add
      Specified by:
      add in interface ICountMap<K>
      Parameters:
      key - key
      count - count
      Returns:
      添加后的数量
    • set

      public Long set(K key, long count)
      Description copied from interface: ICountMap
      set
      Specified by:
      set in interface ICountMap<K>
      Parameters:
      key - key
      count - count
      Returns:
      之前的数量 (可为空)
    • get

      public Long get(K key)
      Description copied from interface: ICountMap
      get
      Specified by:
      get in interface ICountMap<K>
      Parameters:
      key - key
      Returns:
      数量 (可为空)
    • remove

      public Long remove(K key)
      Description copied from interface: ICountMap
      set
      Specified by:
      remove in interface ICountMap<K>
      Parameters:
      key - key
      Returns:
      之前的数量 (可为空)
    • size

      public long size()
      Specified by:
      size in interface ICountMap<K>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface ICountMap<K>
    • clear

      public void clear()
      Specified by:
      clear in interface ICountMap<K>
    • keys

      public Set<K> keys()
      Specified by:
      keys in interface ICountMap<K>
    • toMap

      public Map<K,Long> toMap(Supplier<Map<K,Long>> mapSupplier)
      Specified by:
      toMap in interface ICountMap<K>
    • toMap

      public Map<K,Long> toMap()
      Specified by:
      toMap in interface ICountMap<K>
    • iterator

      public Iterator<Map.Entry<K,Long>> iterator()
      Specified by:
      iterator in interface Iterable<K>
    • toString

      public String toString()
      Overrides:
      toString in class Object