I have an ArrayList A which contains list of transfer Objects. Also i have an another ArrayList B which contains a subset of ArrayList B. My problem is to get two seperate ArrayLists, one containting the elements in B and the other containg the elements not in B which are present in A. I am able to do this by taking the first element in A and check if it is present B, if present adding to the corresponding Arraylist. I repeting the whole process. This is inefficient, can anyone suggest better way of doing this.