I have two array lists list1
and list2
and I want list2
order as the order of list1
. Is there any way to do this? In one list I got the top performing emploee from database and list two got from database second time using the top performing employee ids using "in"
clause.
List<Long> list1 = new ArrayList<Long>();
list1.add(5645);
list1.add(2312);
list1.add(7845);
list1.add(1212);
and other List of object type:
List<Employee> list2 = new ArrayList<Employee>();
list2.add(new Employee(1212, "A"));
list2.add(new Employee(2312, "V"));
list2.add(new Employee(5645, "D"));
list2.add(new Employee(7845, "T"));
where list1
shows the employee id of top 4;
and I got the employee detail from the data base using id and got this list2.
Now I want to make the order of list2
as list1
to show on the html page.