-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctionalSortedSet.java
More file actions
31 lines (28 loc) · 1.06 KB
/
FunctionalSortedSet.java
File metadata and controls
31 lines (28 loc) · 1.06 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
import java.util.function.Predicate;
import java.util.Comparator;
import java.util.SortedSet;
/**
* An interface that extends SortedSet, which extends Set,
* which extends Collection. It provides Functional behaviors that will make
* use of Java 8's new Stream API.
*
* A FunctionalSortedSet maintains a sorted property based on a Comparator,
* and can be resorted using a new one, or filtered based on a Predicate.
*
* @author Joe Rossi
* @version 1.0
* @param <E> The type of elements the FunctionalSortedSet contains.
*/
public interface FunctionalSortedSet<E> extends SortedSet<E> {
/**
* @param p a Predicate that either "has" or "is" a boolean valued method
* @return a new FunctionalSortedSet with elements whose predicate calls
* returned false removed
*/
FunctionalSortedSet<E> filter(Predicate<E> p);
/**
* @param c a Comparator that either "has" or "is" an int valued method
* @return a new FunctionalSortedSet with the elements sorted based on c
*/
FunctionalSortedSet<E> sort(Comparator<E> c);
}