android - how to remove duplicate Element from Arraylist in java -


    { "744101", "744101","744101", "744102",744102","744102","744102","744102","744103","744103"}       list<string> list2=new new arraylist<string>();  //            arrays.sort(iarr);                             for(int k=0;k<iarr.length;k++) {                                 list2.add(string.valueof(iarr[k]));                             }     list li2 = new array list(new hashset(list2));  

i'm unable result while trying sort array list. please correct me.

the treeset both sorts elements , removes duplicates.

    string[] array = { "744101", "744101","744101", "744102","744102","744102","744102","744102","744103","744103"};     list<string> list = new arraylist<>(new treeset<>(arrays.aslist(array)));      list.foreach((element)->{         system.out.println(element);     }); 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -