Sort lists before testing equality