initial commit

This commit is contained in:
2024-06-13 15:37:45 +02:00
parent 8c224faa0e
commit fa85372c13
26 changed files with 629 additions and 0 deletions

View 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);
}