From 09c6a9e2bce109e5137699bfd358f1e2b6b3e364 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 9 May 2018 12:37:09 +0200 Subject: [PATCH] Add Objects.equals(Object, Object) --- .../src/main/java/org/jivesoftware/smack/util/Objects.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/Objects.java b/smack-core/src/main/java/org/jivesoftware/smack/util/Objects.java index a48696c60..26d0bbe85 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/Objects.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/Objects.java @@ -1,6 +1,6 @@ /** * - * Copyright 2015 Florian Schmaus + * Copyright 2015-2018 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,4 +28,8 @@ public class Objects { public static T requireNonNull(T obj) { return requireNonNull(obj, null); } + + public static boolean equals(Object a, Object b) { + return a == b || (a != null && a.equals(b)); + } }