hello
In my assignment we asked to create classes like student, grade, semester, course
all of them have constructors & methods.
We have to create hashmap that contains key as student id & object of studentRecord(a nother class which contains student data)
then we have to create treeset of grades in the student record so that all the grades will be sorted by semester wise.
I am not able to create a treeset because it accept the grade as raw type when I did tht I can't call the iterator
Set<Grade> t = new TreeSet<Grade>( );
t.add(g1)
Iterator <key>i = m.iterator<key> (); -> asks for expression.
I created the generic method printmap like the following
public <key> void printSet(key g, TreeSet<key> m)
{
m.add(g);
System.out.prin tln("TreeSet of Grades: ");
Iterator <key>i = m.iterator<key> ();
}
}
In the class called StudentDatabase [contains main() ] hashmap is created <string, studentRecord> then its printed
then I want to call a method printSet to print treeset
SO how to use iterator of reference or raw types (like Object)
please reply soon, it's urgent
In my assignment we asked to create classes like student, grade, semester, course
all of them have constructors & methods.
We have to create hashmap that contains key as student id & object of studentRecord(a nother class which contains student data)
then we have to create treeset of grades in the student record so that all the grades will be sorted by semester wise.
I am not able to create a treeset because it accept the grade as raw type when I did tht I can't call the iterator
Set<Grade> t = new TreeSet<Grade>( );
t.add(g1)
Iterator <key>i = m.iterator<key> (); -> asks for expression.
I created the generic method printmap like the following
public <key> void printSet(key g, TreeSet<key> m)
{
m.add(g);
System.out.prin tln("TreeSet of Grades: ");
Iterator <key>i = m.iterator<key> ();
}
}
In the class called StudentDatabase [contains main() ] hashmap is created <string, studentRecord> then its printed
then I want to call a method printSet to print treeset
SO how to use iterator of reference or raw types (like Object)
please reply soon, it's urgent
Comment