Here is the SQL version for the input and output :
with tab1 as ( select 1 as id from dual union all select 1 as id from dual union all
An alternative is to filter repeated elements out of the list but it's not very efficient so I would only use it if the list is small:
List result = myList.stream() .filter(i -> Collections.frequency(myList, i) == 1) .collect(toList());