I have two lists : 1. List of selected elements list1 contains 2,3,4,7 2. List of all elements list2 0,2,3,5,6,7,9
List<Integer> selected = new ArrayList<Integer>();
selected.add(2);
selected.add(3);
selected.add(4);
selected.add(7);
List<Integer> allElements = new ArrayList<Integer>();
allElements.add(0);
allElements.add(2);
allElements.add(3);
allElements.add(5);
allElements.add(6);
allElements.add(7);
allElements.add(9);
What is the best algorithm to create a List or Map of selected elements with a list of element which are lower than this elements. I would like to have :
Map<Integer,List<Integer>> map =>
map<2, list(0)>
map<3, list(0,2)>
map<4, list(0,2,3)>
map<7, list(0,2,3,5,6)>
Thanks
Aucun commentaire:
Enregistrer un commentaire