@Test public void isListEquals() { final List<Integer> l1 = new LinkedList<Integer>(); final List<Integer> l2 = new LinkedList<Integer>(); assertTrue(BeanHelper.isEqualList(null, null)); assertFalse(BeanHelper.isEqualList(null, l2)); assertFalse(BeanHelper.isEqualList(l1, null)); assertTrue(BeanHelper.isEqualList(l1, l2)); l1.add(0); assertFalse(BeanHelper.isEqualList(l1, l2)); l2.add(0); assertTrue(BeanHelper.isEqualList(l1, l2)); l1.add(1); l2.add(1); assertTrue(BeanHelper.isEqualList(l1, l2)); l1.add(2); l2.add(3); assertFalse(BeanHelper.isEqualList(l1, l2)); }
static boolean isEqualList(final Collection<?> c1, final Collection<?> c2) { if (c1 == c2) { return true; } else if (c1 == null) { return false; } else if (c2 == null) { return false; } if (c1.size() != c2.size()) { return false; } final Iterator<?> it1 = c1.iterator(); final Iterator<?> it2 = c2.iterator(); while (it1.hasNext() == true) { final Object o1 = it1.next(); final Object o2 = it2.next(); if (o1 == o2) { continue; } else if (o1 == null) { return false; } else if (o2 == null) { return false; } else if (o1.equals(o2) == false) { return false; } } return true; }
BeanHelper { static boolean isEqualList(final Collection<?> c1, final Collection<?> c2) { if (c1 == c2) { return true; } else if (c1 == null) { return false; } else if (c2 == null) { return false; } if (c1.size() != c2.size()) { return false; } final Iterator<?> it1 = c1.iterator(); final Iterator<?> it2 = c2.iterator(); while (it1.hasNext() == true) { final Object o1 = it1.next(); final Object o2 = it2.next(); if (o1 == o2) { continue; } else if (o1 == null) { return false; } else if (o2 == null) { return false; } else if (o1.equals(o2) == false) { return false; } } return true; } }
BeanHelper { static boolean isEqualList(final Collection<?> c1, final Collection<?> c2) { if (c1 == c2) { return true; } else if (c1 == null) { return false; } else if (c2 == null) { return false; } if (c1.size() != c2.size()) { return false; } final Iterator<?> it1 = c1.iterator(); final Iterator<?> it2 = c2.iterator(); while (it1.hasNext() == true) { final Object o1 = it1.next(); final Object o2 = it2.next(); if (o1 == o2) { continue; } else if (o1 == null) { return false; } else if (o2 == null) { return false; } else if (o1.equals(o2) == false) { return false; } } return true; }  }
BeanHelper { static boolean isEqualList(final Collection<?> c1, final Collection<?> c2) { if (c1 == c2) { return true; } else if (c1 == null) { return false; } else if (c2 == null) { return false; } if (c1.size() != c2.size()) { return false; } final Iterator<?> it1 = c1.iterator(); final Iterator<?> it2 = c2.iterator(); while (it1.hasNext() == true) { final Object o1 = it1.next(); final Object o2 = it2.next(); if (o1 == o2) { continue; } else if (o1 == null) { return false; } else if (o2 == null) { return false; } else if (o1.equals(o2) == false) { return false; } } return true; }  static void enterTestMode(); static void exitTestMode(); static String determinePropertyName(final Method method); static Method determineGetter(final Class<?> clazz, final String fieldname); static Annotation[] getDeclaredAnnotations(final Class<?> clazz, final String fieldname); static Method determineGetter(final Class<?> clazz, final String fieldname, final boolean onlyPublicGetter); static List<Method> getAllGetterMethods(final Class<?> clazz); static List<Method> getAllGetterMethods(final Class<?> clazz, final boolean includingSuperClasses); static String getProperty(final Method method); static Class<?> determinePropertyType(final Method method); static Method determineSetter(final Class<?> clazz, final String fieldname); static Method determineSetter(final Class<?> clazz, final Method method); static void invokeSetter(final Object obj, final Method method, final Object value); static Object invoke(final Object obj, final Method method); static Object invoke(final Object obj, final Method method, final Object[] args); static Object newInstance(final String className); static Object newInstance(final Class<?> clazz); static Object newInstance(final Class<?> clazz, final Class<?> paramType, final Object param); static Object newInstance(final Class<?> clazz, final Class<?> paramType1, final Class<?> paramType2,
      final Object param1,
      final Object param2); static Object newInstance(final Class<?> clazz, final Class<?>[] paramTypes, final Object... params); static Object invoke(final Object obj, final Method method, final Object arg); static Field[] getAllDeclaredFields(Class<?> clazz); static Field getDeclaredField(Class<?> clazz, String fieldname); static Method[] getAllDeclaredMethods(Class<?> clazz); static Object getProperty(final Object bean, final String property); static Object setProperty(final Object bean, final String property, final Object value); static Object getIndexedProperty(final Object bean, final String property); static Object getNestedProperty(final Object bean, final String property); static Field[] getDeclaredPropertyFields(final Class<?> clazz); static Object getFieldValue(final Object obj, final Class<?> clazz, final String fieldname); static Object getFieldValue(final Object obj, final Field field); static boolean copyProperties(final Object src, final Object dest, final String... properties); @SuppressWarnings("unchecked") static boolean copyProperties(final Object src, final Object dest, final boolean whitespaceEqualsNull,
      final String... properties); }
BeanHelper { static boolean isEqualList(final Collection<?> c1, final Collection<?> c2) { if (c1 == c2) { return true; } else if (c1 == null) { return false; } else if (c2 == null) { return false; } if (c1.size() != c2.size()) { return false; } final Iterator<?> it1 = c1.iterator(); final Iterator<?> it2 = c2.iterator(); while (it1.hasNext() == true) { final Object o1 = it1.next(); final Object o2 = it2.next(); if (o1 == o2) { continue; } else if (o1 == null) { return false; } else if (o2 == null) { return false; } else if (o1.equals(o2) == false) { return false; } } return true; }  static void enterTestMode(); static void exitTestMode(); static String determinePropertyName(final Method method); static Method determineGetter(final Class<?> clazz, final String fieldname); static Annotation[] getDeclaredAnnotations(final Class<?> clazz, final String fieldname); static Method determineGetter(final Class<?> clazz, final String fieldname, final boolean onlyPublicGetter); static List<Method> getAllGetterMethods(final Class<?> clazz); static List<Method> getAllGetterMethods(final Class<?> clazz, final boolean includingSuperClasses); static String getProperty(final Method method); static Class<?> determinePropertyType(final Method method); static Method determineSetter(final Class<?> clazz, final String fieldname); static Method determineSetter(final Class<?> clazz, final Method method); static void invokeSetter(final Object obj, final Method method, final Object value); static Object invoke(final Object obj, final Method method); static Object invoke(final Object obj, final Method method, final Object[] args); static Object newInstance(final String className); static Object newInstance(final Class<?> clazz); static Object newInstance(final Class<?> clazz, final Class<?> paramType, final Object param); static Object newInstance(final Class<?> clazz, final Class<?> paramType1, final Class<?> paramType2,
      final Object param1,
      final Object param2); static Object newInstance(final Class<?> clazz, final Class<?>[] paramTypes, final Object... params); static Object invoke(final Object obj, final Method method, final Object arg); static Field[] getAllDeclaredFields(Class<?> clazz); static Field getDeclaredField(Class<?> clazz, String fieldname); static Method[] getAllDeclaredMethods(Class<?> clazz); static Object getProperty(final Object bean, final String property); static Object setProperty(final Object bean, final String property, final Object value); static Object getIndexedProperty(final Object bean, final String property); static Object getNestedProperty(final Object bean, final String property); static Field[] getDeclaredPropertyFields(final Class<?> clazz); static Object getFieldValue(final Object obj, final Class<?> clazz, final String fieldname); static Object getFieldValue(final Object obj, final Field field); static boolean copyProperties(final Object src, final Object dest, final String... properties); @SuppressWarnings("unchecked") static boolean copyProperties(final Object src, final Object dest, final boolean whitespaceEqualsNull,
      final String... properties);  }