initial commit
This commit is contained in:
61
src/uebung09/collection/Set.java
Normal file
61
src/uebung09/collection/Set.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package collection;
|
||||
|
||||
/**
|
||||
* A set of elements that does not contain any element twice.
|
||||
*
|
||||
* @param <E> the type of all contained elements.
|
||||
*/
|
||||
public interface Set<E> extends Iterable<E> {
|
||||
/**
|
||||
* Returns the number of elements stored in this set.
|
||||
*
|
||||
* @return the number of elements in this set
|
||||
*/
|
||||
int size();
|
||||
|
||||
/**
|
||||
* Returns true if this set contains no elements.
|
||||
*
|
||||
* @return true if this set contains no elements
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Returns true if this set contains the specified element.
|
||||
*
|
||||
* @return true if this set contains the specified element.
|
||||
*/
|
||||
boolean contains(Object el);
|
||||
|
||||
/**
|
||||
* Returns the union set of this set and the specified set.
|
||||
*
|
||||
* @param other a set
|
||||
* @return the union set of this set and the specified set.
|
||||
*/
|
||||
Set<E> union(Set<E> other);
|
||||
|
||||
/**
|
||||
* returns the set resulting from adding the specified element to this set.
|
||||
*
|
||||
* @param element an element (must not be null)
|
||||
* @return the set resulting from adding the specified element to this set.
|
||||
*/
|
||||
Set<E> add(E element);
|
||||
|
||||
/**
|
||||
* Returns the intersection of this set and the specified set.
|
||||
*
|
||||
* @param other a set
|
||||
* @return the intersection of this set and the specified set.
|
||||
*/
|
||||
Set<E> intersection(Set<E> other);
|
||||
|
||||
/**
|
||||
* Returns true if all elements of this set are contained in the specified set.
|
||||
*
|
||||
* @param other a set
|
||||
* @return true if all elements of this set are contained in the specified set.
|
||||
*/
|
||||
boolean subsetOf(Set<?> other);
|
||||
}
|
Reference in New Issue
Block a user