• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chapter 3(K&B) code problems

 
Tontang Bei
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I modified BeerSelect.java given in the book to work with generics. and I get this warning when I compiled with -Xlint:unchecked which say:

found : java.util.List
required: java.util.List<java.lang.String>
List<String>result=b1.getBrands(c);

I know this happens when you assign raw type to generic type. But I do not think I am assigning raw type to generic type.
The code for BeerExpert.java is given below:


I have used generics everywhere. Why this is still happening?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either change

or
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so this is 1.5 stuff ?
 
Tontang Bei
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Satou. I used your code, it works!.

Yes this is 1.5 stuff. Generics.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic