comparison artifacts/src/main/java/org/dive4elements/river/utils/CompareUtil.java @ 6959:c80671932461

Added new CompareUtil (singleton Helper class).
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 03 Sep 2013 21:49:30 +0200
parents
children
comparison
equal deleted inserted replaced
6958:d2bf655bd278 6959:c80671932461
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU AGPL (>=v3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
6 * documentation coming with Dive4Elements River for details.
7 */
8
9 package org.dive4elements.river.utils;
10
11 /** Utils to deal with Comparisons. */
12 public class CompareUtil
13 {
14 /** Singleton. */
15 private CompareUtil() {
16 }
17
18 /** Return true if a and b are either both null or equal(). */
19 public static <T> boolean areSame(T a, T b) {
20 if (a == null) return b == null;
21 if (b == null) return false;
22 return a.equals(b);
23 }
24 }
25 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org