This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Problems with generics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problems with generics" Watch "Problems with generics" New topic
Author

Problems with generics

Adewale Adebusoye
Ranch Hand

Joined: Sep 28, 2005
Posts: 118
Hi:

I have written a simple library for an assignment called GenericSet. It extends TreeSet, and its meant to be able to contain unique objects of the same type.And all the methods are static as required in the question.

Now when i run the code using a test class...i get this error:

incompatible types; no instance(s) of type variable(s) T exist so that com.GenericSet.GenericSet conforms to com.GenericSet.GenericSet<java.lang.Double>
found : <T>com.GenericSet.GenericSet
required: com.GenericSet.GenericSet<java.lang.Double>
GenericSet<Double> set2=GenericSet.initialize();

i dont know how to solve it. The code for my Library and the test clas sis below:

GenericSet Library




Now this is my test class



Please please can someone tell me where i went wrong?

Thanks


"Human beings can alter their lives by altering their state of mind" William James
Adewale Adebusoye
Ranch Hand

Joined: Sep 28, 2005
Posts: 118
oh and the error is in the testGen() method.
Thanks
 
 
subject: Problems with generics
 
Similar Threads
TreeSet - Object input and output
Comparing two collections...
Garbage collection
Plot update error - JMathPlot
need help again