For example, I have:
import java.util.LinkedList; public class Main { public static void main(String[] args) { LinkedList first = new LinkedList(); // first = ['A', 'B', 'B', 'A'] LinkedList second = new LinkedList(); // second = ['B', 'A'] } }
I need to remove all items from the first list that are in the second. In the end should be:
first = ['A', 'B'],
second = [] or second = ['B', 'A']
But it is desirable not to use a cycle. Is this possible or do I ask too much?