List of usage examples for java.lang Object equals
public boolean equals(Object obj)
From source file:Main.java
/** * Recursively iterate the given {@link Collection} and all {@link Collection}s within it. When an element is encountered that equals * the given {@link Object}, the method returns {@code true}. * * @param collection The collection to iterate recursively. * @param o The object to look for in the collection. * * @return {@code true} if the object was found anywhere within the collection or any of its sub-collections. *///from www. j a v a 2 s .com public static boolean recurseContains(@Nonnull final Iterable<?> collection, @Nullable final Object o) { for (final Object co : collection) if (co.equals(o) || co instanceof Collection<?> && recurseContains((Iterable<?>) co, o)) return true; return false; }
From source file:Main.java
public static boolean equals(Object a, Object b) { return a == b || a != null && b != null && a.equals(b); }
From source file:Main.java
/** * Compare two objects for equality.//from ww w .j a va 2 s . c o m * * @param o1 one object * @param o2 another object * @return true if equals, false otherwise */ public static boolean isEquals(Object o1, Object o2) { return (o1 == o2) || (o1 != null && o1.equals(o2)); }
From source file:Main.java
public static int zeroConvert(Object src) { if (src == null || src.equals("null")) { return 0; } else {/*from www . j a v a 2s . c o m*/ return Integer.parseInt(((String) src).trim()); } }
From source file:Main.java
static boolean objectEquals(Object a, Object b) { return (a == b) || (a != null && a.equals(b)); }
From source file:Main.java
public static List intersection(Object array1[], Object array2[]) { ArrayList result = new ArrayList(); if (array1 != null && array2 != null) { for (int i = 0; i < array1.length; i++) { Object o1 = array1[i]; for (int j = 0; j < array2.length; j++) { Object o2 = array2[j]; if (o2.equals(o1)) { result.add(o1);// ww w .j av a2 s.c o m } } } } return result; }
From source file:Main.java
/** * Ensure that the two values given are equal, if not fail the test * /* w w w.j a v a 2 s . c o m*/ * @param a1 * The first value to compare * @param a2 * The second value to compare */ public static void assertEquals(Object a1, Object a2) { if (!a1.equals(a2)) { throw new RuntimeException("TEST FAILS: " + a1 + " should be " + a2); } }
From source file:Main.java
public static boolean isEqual(Object o1, Object o2) { return o1 == o2 || (o1 != null && o1.equals(o2)); }
From source file:Main.java
public static boolean equals(Object a, Object b) { return (a == null) ? (b == null) : a.equals(b); }
From source file:Main.java
static boolean contains(Object[] a, Object o) { for (Object e : a) { if (o.equals(e)) { return true; }/*w ww . j av a 2 s . c om*/ } return false; }