V
V
Vitaly2016-11-11 13:30:08
Programming
Vitaly, 2016-11-11 13:30:08

How to find different elements of Arraylist?

Tell me, there are 2 collections

ArrayList result1 = new ArrayList();
result1.Add("Привет")
result1.Add("Привет2")
result1.Add("Привет3")
result1.Add("Привет4")
result1.Add("Привет5")



ArrayList result2 = new ArrayList();
result2.Add("Привет")
result2.Add("Привет3")
result2.Add("Привет5")

The task is to display or save different values ​​anywhere, namely - Hello2, Hello4. How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Fedoryan, 2016-11-11
@zet694

Working with sets

S
Sergey, 2016-11-11
@senal

result1.Except(result2).Union(result2.Except(result1));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question