-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSet.java
More file actions
47 lines (41 loc) · 1.13 KB
/
Set.java
File metadata and controls
47 lines (41 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* @author Pepe Gallardo, Data Structures, Grado en Informática. UMA.
*
* Interface for sets.
*/
package set;
/**
* Interface for sets (collection of non-repeated elements).
*
* @param <T> Type of elements in set.
*/
public interface Set<T> extends Iterable<T> {
/**
* Test for set emptiness.
* @return {@code true} if set is empty, else {@code false}.
*/
boolean isEmpty();
/**
* Retrieves number of elements in set (its cardinal).
* @return Number of elements in set.
*/
int size();
/**
* Inserts new element in set. If element was already included, set is not modified
* (this is not considered an error and thus no exception is thrown).
* @param x Element to insert.
*/
void insert(T x);
/**
* Tests whether element is included in set.
* @param x Element to test for inclusion.
* @return {@code true} if element {@code x} is in set, else {@code false}.
*/
boolean isElem(T x);
/**
* Removes element from set. If element is not in set, set is not modified
* (this is not considered an error and thus no exception is thrown).
* @param x Element to remove.
*/
void delete(T x);
}