java - How do I convert an array of strings to a array of unique values? -


In Java, how can I convert an array of stars to an array of unique values? I have this string of strings:

If string [] test = {"1", "1", "1", "2"}

/ P>

 and I want to end with: 

  string [] uq = {"1", "2"}  

will be quick but inappropriately:

 set  & lt; String & gt; Temp = new hashset & lt; String & gt; (Arrays.asList (test)); String [] uq = temp.toArray (new string [temp.size ()]);  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -