// Map of all names onto their corresponding IDs
Map<Integer, String> names = new HashMap<Integer, String>();
// Get all users having the given IDs
UserExample example = new UserExample();
example.createCriteria().andUser_idIn(Lists.newArrayList(ids));
List<User> users =
userDAO.selectByExample(example);
// Produce set of names
for (User user : users)