Created
October 5, 2016 10:55
-
-
Save yurii-litvinov/ce846717a7d86153fd639fb0ae060b78 to your computer and use it in GitHub Desktop.
Interface of Multiset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package task; | |
import java.util.Collection; | |
import java.util.Iterator; | |
import java.util.Set; | |
public interface Multiset<E> extends Collection<E> { | |
/** | |
* Returns the number of occurrences of an element in this multiset. | |
* <p> | |
* Expected complexity: Same as `contains` | |
*/ | |
int count(Object element); | |
/** | |
* Returns the set of distinct elements contained in this multiset. | |
* <p> | |
* Expected complexity: O(1) | |
*/ | |
Set<E> elementSet(); | |
/** | |
* Returns the set of entries representing the data of this multiset. | |
* <p> | |
* Expected complexity: O(1) | |
*/ | |
Set<Entry<E>> entrySet(); | |
/** | |
* Elements that occur multiple times in the multiset will appear multiple times in this iterator. | |
* <p> | |
* Expected complexity: O(1) | |
*/ | |
@Override | |
Iterator<E> iterator(); | |
interface Entry<E> { | |
E getElement(); | |
int getCount(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment