简体   繁体   中英

Selection from ormlite database table without duplicates

i am querying a table in my ormlite table which contains value1,value2,value2,value2,value3,value3,value4. i query the table and displays it in a recyclerview. I don't want the same value in the recyclerview twice. This is how am querying the table

 list = valueDao.queryForAll();

i need the list to just contain value1,value2,value3,value4 removing the duplicate values.

If you don't need to keep the values in the same order, something like this:

Set<List> set = new HashSet<>(list);
list.clear();
list.addAll(set);

could work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM