Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions src/MultiSet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import java.util.*;

public interface MultiSet<E> {
/**
* Adds the specified item to this multiset.
*
* @param item item to be added
* @return true if the item was added successfully, false otherwise
*/
boolean add(E item);

/**
* Removes the specified item from this multiset.
*
* @param item item to be removed
*/
void remove(E item);

/**
* Returns true if this multiset contains the specified item.
*
* @param item item whose presence in this multiset is to be tested
* @return true if this multiset contains the specified item
*/
boolean contains(E item);

/**
* Returns true if this multiset contains no items.
*
* @return true if this multiset contains no items
*/
boolean isEmpty();

/**
* Returns the count of the specified item in this multiset.
*
* @param item item whose count is to be returned
* @return the count of the specified item in this multiset
*/
int count(E item);

/**
* Returns the number of items in this multiset.
*
* @return the number of items in this multiset
*/
int size();
}