Class AbstractMultiset<E>
java.lang.Object
java.util.AbstractCollection<E>
cloud.opencode.base.collections.specialized.AbstractMultiset<E>
- Type Parameters:
E- element type | 元素类型
- All Implemented Interfaces:
Multiset<E>, Iterable<E>, Collection<E>
- Direct Known Subclasses:
LinkedHashMultiset, TreeMultiset
AbstractMultiset - Abstract Multiset Base Class
AbstractMultiset - 抽象多重集合基类
Provides a skeletal implementation of the Multiset interface.
提供 Multiset 接口的骨架实现。
Features | 主要功能:
- Skeletal multiset implementation - 骨架多重集合实现
- Count-based element tracking - 基于计数的元素跟踪
- Collection interface compliance - 集合接口兼容
Usage Examples | 使用示例:
// Subclasses provide backing store
Multiset<String> multiset = HashMultiset.create();
multiset.add("a", 3);
int count = multiset.count("a"); // 3
Security | 安全性:
- Thread-safe: No (not synchronized) - 否(未同步)
- Null-safe: Implementation-dependent - 取决于实现
- Since:
- JDK 25, opencode-base-collections V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface Multiset
Multiset.Entry<E> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd one occurrence of the element.booleanaddAll(Collection<? extends E> c) booleancontainsAll(Collection<?> c) booleaninthashCode()booleanRemove one occurrence of the element.booleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) Object[]toArray()<T> T[]toArray(T[] a) toString()Methods inherited from interface Collection
clear, isEmpty, iterator, parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
AbstractMultiset
public AbstractMultiset()
-
-
Method Details
-
add
Description copied from interface:MultisetAdd one occurrence of the element. 添加元素的一个出现。- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceMultiset<E>- Overrides:
addin classAbstractCollection<E>- Parameters:
element- the element | 元素- Returns:
- always true | 始终为 true
-
remove
Description copied from interface:MultisetRemove one occurrence of the element. 移除元素的一个出现。- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceMultiset<E>- Overrides:
removein classAbstractCollection<E>- Parameters:
element- the element | 元素- Returns:
- true if element was present | 如果元素存在则返回 true
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Overrides:
containsAllin classAbstractCollection<E>
-
addAll
- Specified by:
addAllin interfaceCollection<E>- Overrides:
addAllin classAbstractCollection<E>
-
removeAll
- Specified by:
removeAllin interfaceCollection<E>- Overrides:
removeAllin classAbstractCollection<E>
-
retainAll
- Specified by:
retainAllin interfaceCollection<E>- Overrides:
retainAllin classAbstractCollection<E>
-
toArray
- Specified by:
toArrayin interfaceCollection<E>- Overrides:
toArrayin classAbstractCollection<E>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArrayin interfaceCollection<E>- Overrides:
toArrayin classAbstractCollection<E>
-
equals
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<E>- Overrides:
hashCodein classObject
-
toString
- Overrides:
toStringin classAbstractCollection<E>
-