This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with return type map

 
indu iyengar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

am using java5..I have a method with return type map...
when I declare the method signature in interface it is not showing any error

but if I declare like this it shows the error
set return type as void
we should not declare generics in return type ?
 
Matthew Brown
Bartender
Posts: 4566
8
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Map<String, Integer> - primitives can't be applied as generic types. Declare the generic type as Integer and the auto-boxing will allow you to add ints to it.
 
indu iyengar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic