Duplicate Elimination in java -


i need write program enter 5 numbers 10 100 don't know how can eliminate duplicates? got bright ideas on how can it?

use set implementation whic definition not contain duplicates...

treeset<integer> ints = new treeset<integer>();  int[] int_array = { 1, 2, 3, 4, 3, 5, 4, 2, 3, 4, 3 4, 2, 1 };  (int n : int_arr)    ints.add(n);  (int n : ints)   system.out.preintln(n); 

outputs: 1 2 3 4 5


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -