2 * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.util;
10 import com.google.common.base.MoreObjects;
11 import java.util.function.BiFunction;
14 * Utility helping to implement readable equals() methods.
19 * public boolean equals(Object obj) {
20 * return EvenMoreObjects.equalsHelper(this, obj,
21 * (one, another) -> Objects.equals(one.name, another.name) && Objects.equals(one.age, another.age));
25 * <p>See <a href="https://github.com/google/guava/issues/2521">Guava issue proposing contributing this</a>.
29 * @author Michael Vorburger, Red Hat
31 @Deprecated(since = "11.0.0", forRemoval = true)
32 public final class EvenMoreObjects {
34 @SuppressWarnings("unchecked")
35 public static <T> boolean equalsHelper(final T self, final Object other, final BooleanEqualsFunction<T> equals) {
42 if (self.getClass() != other.getClass()) {
45 return equals.apply(self, (T) other);
49 public interface BooleanEqualsFunction<T> extends BiFunction<T, T, Boolean> { }
51 private EvenMoreObjects() {