Of course, your method is public, so it doesn't matter where it is. It is better to design it in a book to facilitate the custom comparison of member variables, because the collection is in the library, and it will automatically help you sort when you construct the collection, which is new.