• Post Reply Bookmark Topic Watch Topic
  • New Topic

return type of get method for CMR field

 
mini mehta
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

The spec says that the get method of CMR field's should return Collection or Set. I am hoping that means any subclass of Collection or subclass of Set. So returning a List object should be OK, assuming the get method has declared return type as Collection or Set.

Thanks.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes , you could retutn List.
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mini,

Collection & Set are interfaces. End of the day, you've to choose an implementing class to hold your objects. So any implementing classes of Collection or Set should work.

HTH.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!