List of usage examples for java.lang Object equals
public boolean equals(Object obj)
From source file:Main.java
public static boolean equal(Object o1, Object o2) { return o1 == null ? o2 == null : o1.equals(o2); }
From source file:Main.java
/** * @param comboBox/*from ww w .j a v a 2 s . c o m*/ * @param value * @return if the comboBox contains the specified value */ public static boolean containsValue(JComboBox comboBox, String value) { ComboBoxModel model = comboBox.getModel(); int size = model.getSize(); for (int i = 0; i < size; i++) { Object element = model.getElementAt(i); if (element.equals(value)) { return true; } } return false; }
From source file:Main.java
@NonNull private static ArrayList<String> nonblankPathSegments(Object[] paths) { ArrayList<String> list = new ArrayList<>(); for (Object path : paths) { if (path != null && !path.equals("")) { list.add((String) path); }//from w w w . ja va 2s . c o m } return list; }
From source file:Main.java
public static boolean equals(Object a, Object b) { return (a == b) || (a == null ? false : a.equals(b)); }
From source file:Main.java
public static boolean isLinked(Object child, List<Object> childList) { /* Do not add to list if child is already referenced in list -- avoid dups */ for (Object obj : childList) { if (obj.equals(child)) { return true; } else if (child instanceof List) { /* child is a list - our first object eqivalancy will not work * Iterate through items since child is a list and check */ for (Object obj2 : (List<Object>) child) { if (obj.equals(obj2)) { return true; }//w w w .j a v a 2 s.c om } } } return false; }
From source file:Main.java
/** * Can't believe I need to write this myself, but I guess * it's just 7 lines of code and infinitely more trustworthy * than that java.Arrays.binarySearch crap. * TODO this probably should go into some sort of kUtil class *///from ww w . j a v a2s . co m public static int arrayLinearSearch(Object[] a, Object s) { for (int i = 0; i < a.length; i++) { if (s.equals(a[i])) return i; } return -1; }
From source file:Main.java
public static boolean areNullSafeEquals(Object obj1, Object obj2) { return obj1 == null ? obj2 == null : obj1.equals(obj2); }
From source file:Main.java
/** * Tests two objects for {@link Object#equals(Object)} equality, handling the case where one or * both may be null./*ww w .j ava 2 s . co m*/ * * @param o1 The first object. * @param o2 The second object. * @return {@code o1 == null ? o2 == null : o1.equals(o2)}. */ public static boolean areEqual(Object o1, Object o2) { return o1 == null ? o2 == null : o1.equals(o2); }
From source file:Main.java
public static void assertEquals(String message, Object val1, Object val2) { if (message != null) { assert val1.equals(val2) : message; } else {//from w w w . j a v a 2s.com assert val1.equals(val2); } }
From source file:Main.java
public static boolean isDataChanged(Object newData, Object oldData) { return (oldData != newData) && (oldData == null || !oldData.equals(newData)); }