• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unique and non null values in String array ?

 
kri shan
Ranch Hand
Posts: 1478
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to strore unique and non null values in String array ?
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pretty much the same way you would store anything in an array. You're posting in Intermediate - have you ever used a Java array? It's mostly straightforward. If you have any difficulties, please tell us, more specifically, what you're having trouble with. We don't want to explain every step along the way, after all.

Alternately, I suspect that this question may have been misguided in the first place. I think the question should have been, how should I store unique, non-null values into some sort of object that collects them efficiently? And the answer would be: forget about arrays, and take a look at the Set interface. HashSet would be the obvious choice for an implementation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic