I have two classes, Image and Channel.Image has an imageId and Channel has a channelId which uniquely identify an Image and Channel object.Some other attributes are also present.
Image class also has a channelId, using which I determine to which channel the image has been assigned to. I have a two ArrayLists of Image and Channel respectively.
List<Image> imageList = getItemist("image");
List<Image> channelList = getItemList("channel");
Now, I would like to remove all those image objects from the image list which contain channelId which are present in the channel objects of the channelList.
As of now, I am iterating the two lists and then comparing the channelId, putting the Image objects in a TreeSet and finally returning a list.Can you please help me with a solution that is simpler or more efficient ?