Java xor xor(T l1, T l2)

Here you can find the source of xor(T l1, T l2)

Description

xor

License

Apache License

Declaration

public static <T> T xor(T l1, T l2) 

Method Source Code

//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;
    }
}

Related

  1. xor(int[] byteOne, int[] byteTwo)
  2. xor(int[][] array, int[][] array2)
  3. xor(long x, long y)
  4. xor(short b1, short b2)
  5. xor(String key, String input)
  6. xor32(byte[] a, short aOffset, byte[] b, short bOffset, byte[] result, short offset)
  7. xorFolding(final long hash, final int shift)
  8. xorInPlace(byte[] source, int sourceOffset, byte[] destination, int destinationOffset, int size)
  9. xorInt64OverBytesLE(long val, byte[] data, int ofs)