Class ArrayMultiset<T>
java.lang.Object
ArrayMultiset<T>
- All Implemented Interfaces:
Multiset<T>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a new element to this multiset.voidclear()Removes all elements from the multiset.booleanDetermines if the multiset contains the specified element.intgetOccurrencesOf(T element) Counts the number of times the specified element appears in the multiset.booleanisEmpty()Determines if there are any elements in the multiset.booleanisFull()remove()Removes one unspecified element from the multiset, if possible.booleanRemoves one occurrence of the specified element from the multiset, if possible.intsize()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:MultisetAdds a new element to this multiset. -
remove
Description copied from interface:MultisetRemoves one unspecified element from the multiset, if possible. -
remove
Description copied from interface:MultisetRemoves one occurrence of the specified element from the multiset, if possible. -
getOccurrencesOf
Description copied from interface:MultisetCounts the number of times the specified element appears in the multiset.- Specified by:
getOccurrencesOfin 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:MultisetDetermines if the multiset contains the specified element. -
isEmpty
public boolean isEmpty()Description copied from interface:MultisetDetermines if there are any elements in the multiset. -
isFull
public boolean isFull() -
size
public int size()Description copied from interface:MultisetGets the number of elements in the multiset. -
clear
public void clear()Description copied from interface:MultisetRemoves all elements from the multiset. -
toString
-