jodd.util.Util.equals()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中jodd.util.Util.equals()方法的一些代码示例,展示了Util.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.equals()方法的具体详情如下:
包路径:jodd.util.Util
类名称:Util
方法名:equals

Util.equals介绍

[英]Safely compares two objects just like equals() would, except it allows any of the 2 objects to be null.
[中]安全地比较两个对象,就像equals()一样,只不过它允许两个对象中的任何一个为null

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Compares 2 strings. If one of the strings is <code>null</code>, <code>false</code> is returned. if
 * both string are <code>null</code>, <code>true</code> is returned.
 *
 * @param s1     first string to compare
 * @param s2     second string
 *
 * @return <code>true</code> if strings are equal, otherwise <code>false</code>
 */
public static boolean equals(String s1, String s2) {
  return Util.equals(s1, s2);
}

代码示例来源:origin: oblac/jodd

/**
 * Compares 2 strings. If one of the strings is <code>null</code>, <code>false</code> is returned. if
 * both string are <code>null</code>, <code>true</code> is returned.
 *
 * @param s1     first string to compare
 * @param s2     second string
 *
 * @return <code>true</code> if strings are equal, otherwise <code>false</code>
 */
public static boolean equals(final String s1, final String s2) {
  return Util.equals(s1, s2);
}

代码示例来源:origin: redisson/redisson

while (iter.hasNext()) {
  Object o = iter.next();
  if (equals(o, element)) {
    return true;
while (enumeration.hasMoreElements()) {
  Object o = enumeration.nextElement();
  if (equals(o, element)) {
    return true;
for (int i = 0; i < len; i++) {
  Object o = Array.get(obj, i);
  if (equals(o, element)) {
    return true;

代码示例来源:origin: oblac/jodd

while (iter.hasNext()) {
  Object o = iter.next();
  if (equals(o, element)) {
    return true;
while (enumeration.hasMoreElements()) {
  Object o = enumeration.nextElement();
  if (equals(o, element)) {
    return true;
for (int i = 0; i < len; i++) {
  Object o = Array.get(obj, i);
  if (equals(o, element)) {
    return true;

代码示例来源:origin: oblac/jodd

@Test
void testEquals() {
  Object a = new Integer(173);
  Object b = new Integer(1);
  Object c = new Integer(173);
  assertTrue(Util.equals(a, a));
  assertTrue(Util.equals(a, c));
  assertTrue(Util.equals(c, a));
  assertFalse(Util.equals(a, b));
  assertFalse(Util.equals(b, a));
  assertFalse(Util.equals(a, null));
  assertFalse(Util.equals(null, a));
  assertTrue(Util.equals(null, null));
}

代码示例来源:origin: org.jodd/jodd-core

/**
 * Compares 2 strings. If one of the strings is <code>null</code>, <code>false</code> is returned. if
 * both string are <code>null</code>, <code>true</code> is returned.
 *
 * @param s1     first string to compare
 * @param s2     second string
 *
 * @return <code>true</code> if strings are equal, otherwise <code>false</code>
 */
public static boolean equals(final String s1, final String s2) {
  return Util.equals(s1, s2);
}

代码示例来源:origin: fivesmallq/web-data-extractor

/**
 * Compares 2 strings. If one of the strings is <code>null</code>, <code>false</code> is returned. if
 * both string are <code>null</code>, <code>true</code> is returned.
 *
 * @param s1 first string to compare
 * @param s2 second string
 * @return <code>true</code> if strings are equal, otherwise <code>false</code>
 */
public static boolean equals(String s1, String s2) {
  return Util.equals(s1, s2);
}

代码示例来源:origin: fivesmallq/web-data-extractor

while (iter.hasNext()) {
  Object o = iter.next();
  if (equals(o, element)) {
    return true;
while (enumeration.hasMoreElements()) {
  Object o = enumeration.nextElement();
  if (equals(o, element)) {
    return true;
for (int i = 0; i < len; i++) {
  Object o = Array.get(obj, i);
  if (equals(o, element)) {
    return true;

代码示例来源:origin: org.jodd/jodd-core

while (iter.hasNext()) {
  Object o = iter.next();
  if (equals(o, element)) {
    return true;
while (enumeration.hasMoreElements()) {
  Object o = enumeration.nextElement();
  if (equals(o, element)) {
    return true;
for (int i = 0; i < len; i++) {
  Object o = Array.get(obj, i);
  if (equals(o, element)) {
    return true;

相关文章

微信公众号

最新文章

更多