solance
asked on
SortedHashSet Error 2
Hi some of u might have answered my previous question. Thank you. now i have these following problems.
heres my code
import java.io.*;
import java.lang.*;
import java.util.*;
class SortedHashSet<T> extends TreeSet<T> { // inherit from TreeSet
private HashSet<T> hashobject;
public SortedHashSet (){
hashobject = new HashSet<T>(); //create new HashSet object
}
public boolean add(T item){
return super.add(item) && hashobject.add(item);
}
public void clear(){
super.clear();
hashobject.clear();
}
public boolean contains(Object item){
return hashobject.contains(item);
}
public boolean remove(Object item){
return super.remove(item) && hashobject.remove(item);
}
}
then i get the following errors
SortedHashSet.add was missing return tag.
SortedHashSet.contains was missing return tag.
SortedHashSet.remove was missing return tag.
can anyone please help me with this?
heres my code
import java.io.*;
import java.lang.*;
import java.util.*;
class SortedHashSet<T> extends TreeSet<T> { // inherit from TreeSet
private HashSet<T> hashobject;
public SortedHashSet (){
hashobject = new HashSet<T>(); //create new HashSet object
}
public boolean add(T item){
return super.add(item) && hashobject.add(item);
}
public void clear(){
super.clear();
hashobject.clear();
}
public boolean contains(Object item){
return hashobject.contains(item);
}
public boolean remove(Object item){
return super.remove(item) && hashobject.remove(item);
}
}
then i get the following errors
SortedHashSet.add was missing return tag.
SortedHashSet.contains was missing return tag.
SortedHashSet.remove was missing return tag.
can anyone please help me with this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:-)