I am trying to create a linked list that uses the Sorted Set interface but am unclear about what needs to go in certain methods.
I am creating the class and I'll have the app that inserts the data seperate.
What i need is to create the class that uses all the methods that are on the Java site.
Here is what i have so far
I understand the first() and last() methods but whati'm not sure about is tailSet(), headSet(), subSet() and comparator()
Could someone please explain what each of them are for and how i would use it as the explanations I found online are no help whatsoever
I am creating the class and I'll have the app that inserts the data seperate.
What i need is to create the class that uses all the methods that are on the Java site.
Here is what i have so far
Code:
import java.util.*;
import java.util.SortedSet;
import java.util.Set;
public class OrderLinkedList implements SortedSet {
public OrderLinkedList() {
}
public comparator() {
}
public SortedSet subSet(Object toElement, Object fromElement) {
}
public SortedSet headSet(Object toElement) {
}
public SortedSet tailSet(Object fromElement) {
}
public first() {
throw new NoSuchElementException();
return;
}
public last() {
//if (isEmpty())
throw new NoSuchElementException();
return;
}
I understand the first() and last() methods but whati'm not sure about is tailSet(), headSet(), subSet() and comparator()
Could someone please explain what each of them are for and how i would use it as the explanations I found online are no help whatsoever