@Test public void testEquals() throws Exception { String[] strings = new String[] { "a", "b", "c", null, "d" }; List<Object> list1 = new TypedList(stringListType, strings); List<Object> list2 = new TypedList(stringListType); for (String s : strings) { list2.add(s); } assertTrue(list1.equals(list2)); assertTrue(list2.equals(list1)); List<Object> list3 = new TypedList(stringListType); for (String s : strings) { list3.add(0, s); } assertFalse(list1.equals(list3)); assertFalse(list3.equals(list1)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TypedList other = (TypedList) obj; if (inner == null) { if (other.inner != null) { return false; } } else if (!inner.equals(other.inner)) { return false; } if (type == null) { if (other.type != null) { return false; } } else if (!type.equals(other.type)) { return false; } return true; }
TypedList implements List<Object> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TypedList other = (TypedList) obj; if (inner == null) { if (other.inner != null) { return false; } } else if (!inner.equals(other.inner)) { return false; } if (type == null) { if (other.type != null) { return false; } } else if (!type.equals(other.type)) { return false; } return true; } }
TypedList implements List<Object> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TypedList other = (TypedList) obj; if (inner == null) { if (other.inner != null) { return false; } } else if (!inner.equals(other.inner)) { return false; } if (type == null) { if (other.type != null) { return false; } } else if (!type.equals(other.type)) { return false; } return true; } TypedList(final ListType type);  TypedList(final ListType type, final Collection<? extends Object> collection); @SuppressWarnings("unchecked")  TypedList(final ListType type, final Object array); }
TypedList implements List<Object> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TypedList other = (TypedList) obj; if (inner == null) { if (other.inner != null) { return false; } } else if (!inner.equals(other.inner)) { return false; } if (type == null) { if (other.type != null) { return false; } } else if (!type.equals(other.type)) { return false; } return true; } TypedList(final ListType type);  TypedList(final ListType type, final Collection<? extends Object> collection); @SuppressWarnings("unchecked")  TypedList(final ListType type, final Object array); ListType getType(); Type getElementType(); void add(int index, Object element); boolean add(Object o); boolean addAll(Collection<? extends Object> c); boolean addAll(int index, Collection<? extends Object> c); void clear(); boolean contains(Object o); boolean containsAll(Collection<?> c); Object get(int index); int indexOf(Object o); boolean isEmpty(); Iterator<Object> iterator(); int lastIndexOf(Object o); ListIterator<Object> listIterator(); ListIterator<Object> listIterator(int index); Object remove(int index); boolean remove(Object o); boolean removeAll(Collection<?> c); boolean retainAll(Collection<?> c); Object set(int index, Object element); int size(); List<Object> subList(int fromIndex, int toIndex); Object[] toArray(); T[] toArray(T[] a); @Override int hashCode(); @Override boolean equals(Object obj); }
TypedList implements List<Object> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TypedList other = (TypedList) obj; if (inner == null) { if (other.inner != null) { return false; } } else if (!inner.equals(other.inner)) { return false; } if (type == null) { if (other.type != null) { return false; } } else if (!type.equals(other.type)) { return false; } return true; } TypedList(final ListType type);  TypedList(final ListType type, final Collection<? extends Object> collection); @SuppressWarnings("unchecked")  TypedList(final ListType type, final Object array); ListType getType(); Type getElementType(); void add(int index, Object element); boolean add(Object o); boolean addAll(Collection<? extends Object> c); boolean addAll(int index, Collection<? extends Object> c); void clear(); boolean contains(Object o); boolean containsAll(Collection<?> c); Object get(int index); int indexOf(Object o); boolean isEmpty(); Iterator<Object> iterator(); int lastIndexOf(Object o); ListIterator<Object> listIterator(); ListIterator<Object> listIterator(int index); Object remove(int index); boolean remove(Object o); boolean removeAll(Collection<?> c); boolean retainAll(Collection<?> c); Object set(int index, Object element); int size(); List<Object> subList(int fromIndex, int toIndex); Object[] toArray(); T[] toArray(T[] a); @Override int hashCode(); @Override boolean equals(Object obj);  }