• Post Reply Bookmark Topic Watch Topic
  • New Topic

Please improve the collection code  RSS feed

 
Gunjan Kumar
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Problem Statement:
Locale-> Value
____________________________
en-Us-> one,two,three
fo-fr -> x,y,z

I have to make one function like this:
public boolean find(String locale, String value).
IF i will pass find(en-Us,one)->true else false

i have done like this
Problem is-> i have to create so many sets in this case for every locale,

can anybody suggest some improvements in this ode

[ October 16, 2007: Message edited by: Gunjan Kumar ]
[ October 17, 2007: Message edited by: Gunjan Kumar ]
 
bart zagers
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your interface is really

You can just concatenate locale and value and put all those strings in a single Set.
Then your find method just has to do
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!