Here you can find the source of areEqual(Object one, Object another)
Parameter | Description |
---|---|
one | a parameter |
another | a parameter |
public static final boolean areEqual(Object one, Object another)
//package com.java2s; /*L/*from w ww . j av a 2s. c om*/ * Copyright SAIC, SAIC-Frederick. * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/caadapter/LICENSE.txt for details. */ public class Main { /** * Return true if one is equal to another. * @param one * @param another * @return true if one is equal to another. */ public static final boolean areEqual(Object one, Object another) { boolean result = (one == null ? another == null : one.equals(another)); return result; } /** * Return true if one is equal to another. * @param one * @param another * @param treatNullAndBlankStringEquals if true will treat null and blank string the same; otherwise, it will not. * @return true if one is equal to another. */ public static final boolean areEqual(Object one, Object another, boolean treatNullAndBlankStringEquals) { boolean result = (one == null ? another == null : one.equals(another)); if (!result && treatNullAndBlankStringEquals) { String oneStr = one == null ? "" : one.toString(); String anotherStr = another == null ? "" : another.toString(); result = isBlank(oneStr) && isBlank(anotherStr); } return result; } /** * Null string or blank string is considered as blank * @param s * @return true if blank */ public static final boolean isBlank(String s) { return (s == null) || (s.trim().length() == 0); } }