### Question:
TupleDesc implements Serializable { public boolean equals(Object o) { if(o!=null && o instanceof TupleDesc){ if(((TupleDesc) o).items.size()==this.items.size()){ for(int i=0;i<((TupleDesc) o).items.size();i++){ if(!((TupleDesc) o).items.get(i).equals(this.items.get(i))){ return false; } } return true; } } return false; } TupleDesc(Type[] typeAr, String[] fieldAr);  TupleDesc(Type[] typeAr); Iterator<TDItem> iterator(); int numFields(); String getFieldName(int i); Type getFieldType(int i); int fieldNameToIndex(String name); int getSize(); static TupleDesc merge(TupleDesc td1, TupleDesc td2); boolean equals(Object o); int hashCode(); String toString(); public List<TDItem> items; }### Answer:
@Test public void testEquals() { TupleDesc singleInt = new TupleDesc(new Type[]{Type.INT_TYPE}); TupleDesc singleInt2 = new TupleDesc(new Type[]{Type.INT_TYPE}); TupleDesc intString = new TupleDesc(new Type[]{Type.INT_TYPE, Type.STRING_TYPE}); assertFalse(singleInt.equals(null)); assertFalse(singleInt.equals(new Object())); assertTrue(singleInt.equals(singleInt)); assertTrue(singleInt.equals(singleInt2)); assertTrue(singleInt2.equals(singleInt)); assertTrue(intString.equals(intString)); assertFalse(singleInt.equals(intString)); assertFalse(singleInt2.equals(intString)); assertFalse(intString.equals(singleInt)); assertFalse(intString.equals(singleInt2)); }