Android examples for java.util:Collection and Null
Generic Compare two object, allowing nulls
/*// w w w.j av a 2 s . com ******************************************************************************* * Copyright (C) 1996-2015, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ public class Main{ /** * Compare, allowing nulls * @param a * @param b * @return */ public static <T> boolean equals(T a, T b) { return a == null ? b == null : b == null ? false : a.equals(b); } }