It took a comparison. There are 2 sheets of objects of the same type ( field1 and field2 in the example). The object has 3 string parameters (first name, last name, middle name). In the first object there are records of 3 people with all the fields filled, i.e. It looks like this:
- Full name
- Yuri Karamazin Aleksandrovich
- Victor Sushko G.
- Sasha Knyazev Albertovich
And the second object in which records about the same 3 people, but only names are stored:
- Name
- Yuri
- Victor
- Sasha
I need to compare only the parameter of the object "name". I'm trying to compare something like this:
for (FieldOfTest x : field1) { for (FieldOfTest y : field2) { Assert.assertTrue(x.getName().equals(y.getName()), "First value: " + x.getName() + " , second value: " + y.getName()); } } The second for scrolls through the full list. How can I compare 1 object from the first list with one object from the second list?
field1only with the first element offield2, the second - only with the second, etc., then this is done in one cycle. - Regent