Что это за цифра 31? - Маячит уже не в первой задаче result = 31 * result + (second != null ? second.hashCode() : 0);