1: public boolean equals(Object other) 2: { 3: boolean result; 4: 5: if ((other == null) || (getClass() != other.getClass())) 6: result = false; 7: else 8: { 9: // The cast is safe within this else clause 10: @SuppressWarnings("unchecked") 11: Vertex<T> otherVertex = (Vertex<T>)other; 12: result = label.equals(otherVertex.label); 13: } // end if 14: 15: return result; 16: } // end equals