• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems with generics

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Adewale Adebusoye
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh and the error is in the testGen() method.
Thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic