Class ArrayMultiset<T>
java.lang.Object
ArrayMultiset<T>
- All Implemented Interfaces:
Multiset<T>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a new element to this multiset.void
clear()
Removes all elements from the multiset.boolean
Determines if the multiset contains the specified element.int
getOccurrencesOf
(T element) Counts the number of times the specified element appears in the multiset.boolean
isEmpty()
Determines if there are any elements in the multiset.boolean
isFull()
remove()
Removes one unspecified element from the multiset, if possible.boolean
Removes one occurrence of the specified element from the multiset, if possible.int
size()
Gets the number of elements in the multiset.toString()
-
Field Details
-
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITY- See Also:
-
-
Constructor Details
-
ArrayMultiset
public ArrayMultiset(int capacity) -
ArrayMultiset
public ArrayMultiset()
-
-
Method Details
-
add
Description copied from interface:Multiset
Adds a new element to this multiset. -
remove
Description copied from interface:Multiset
Removes one unspecified element from the multiset, if possible. -
remove
Description copied from interface:Multiset
Removes one occurrence of the specified element from the multiset, if possible. -
getOccurrencesOf
Description copied from interface:Multiset
Counts the number of times the specified element appears in the multiset.- Specified by:
getOccurrencesOf
in interfaceMultiset<T>
- Parameters:
element
- the element to be counted- Returns:
- The number of times the element appears in the multiset.
-
contains
Description copied from interface:Multiset
Determines if the multiset contains the specified element. -
isEmpty
public boolean isEmpty()Description copied from interface:Multiset
Determines if there are any elements in the multiset. -
isFull
public boolean isFull() -
size
public int size()Description copied from interface:Multiset
Gets the number of elements in the multiset. -
clear
public void clear()Description copied from interface:Multiset
Removes all elements from the multiset. -
toString
-