Here you can find the source of xorOnLists(List
public static <E> List<E> xorOnLists(List<E> l1, List<E> l2)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <E> List<E> xorOnLists(List<E> l1, List<E> l2) { boolean xor = l1 == null ^ l2 == null; if (xor) { return l1 == null ? l2 : l1; }// w w w . j a va 2s .c o m if (l1 != null) { l1.clear(); return l1; } return null; } }