I have 2 List entities, I don't want to compare it by nested loop if it possible,
let say I have entities like this :
List<Entity1> = entity1Repository.findByCode(String code);
List<Entity2> = entity2Repository.findByName(String name);
and I want to compare those entities, I want the result of the list which that List only value which has the same value,
such as this= [1, 2, 4]
and [1,2,5]
and i want the result like this ==> [1,2]
how to do that in Java?