Ok, If in any case your code look like this :
List<Integer> c = new ArrayList(Arrays.asList(1, 2, 3));
ArrayList<List<String>> contact = new ArrayList<List<String>>();
contact.add(Arrays.asList("One", "1"));
contact.add(Arrays.asList("Two", "2"));
contact.add(Arrays.asList("Three", "3"));
contact.add(Arrays.asList("Four", "4"));
You can use streams like so :
List<String> result = contact.stream()
.filter(l -> c.contains(Integer.valueOf(l.get(1))))
.map(l -> l.get(0))
.collect(Collectors.toList());
this will gives you :
[One, Two, Three]
Better Solution
Rather for a good work, I would create a class Contact which hold id and a name for example :
class Contact{
private Integer id;
private String name;
//constructor getters and setters
}
Then fill your List like so :
ArrayList<Contact> contact = new ArrayList<>();
contact.add(new Contact(1, "One"));
contact.add(new Contact(2, "Two"));
contact.add(new Contact(3, "Three"));
contact.add(new Contact(4, "Four"));
So when you want to search you can use :
List<String> result = contacts.stream()
.filter(l -> c.contains(l.getId()))
.map(Contact::getName)
.collect(Collectors.toList());
It can be more readable and more helpful to work.