Add specs and implementation for equals() function.