Here you can find the source of xor(T l1, T l2)
public static <T> T xor(T l1, T l2)
//package com.java2s; //License from project: Apache License public class Main { public static <T> T xor(T l1, T l2) { boolean xor = l1 == null ^ l2 == null; // TRUE -> ONLY ONE IS INITIALIZED. if (xor) { return l1 == null ? l2 : l1; }//w ww . j a va 2s.c o m // FALSE -> BOTH NULL OR INITIALIZED return null; } }