boolean (Object obj) { if (!(obj instanceof TodoFilter filter)) { return false; } if (!myName.equals(filter.myName)) { return false; } if (myTodoPatterns.size() != filter.myTodoPatterns.size()) { return false; } for (TodoPattern pattern : myTodoPatterns) { if (!filter.contains(pattern)) { return false; } } return true; }