java - Why is sort method part of Collections instead of AbstractList? -
When the sort method works only on lists, then I feel a little bit upset by keeping it in a storage class. Should not a separate category devoted to the list? Maybe something like abstract element or list ..?
"text">
archive is an accessory category, despite all its collections, for all the collections < In addition to the method for code> list
, there are specific methods for the map s, sorted map s, sortedset s, and However, archive s.
Although making a separate subsidiary for lists alone would be a justified option, using one assistant assistant, all the collections will help one place become perfect, as well as: It makes it easy for developers to remember Where are the methods, because there is only one class.
Note that starting with Java-8 you can call sort , and make it easier to find the implementation.
No comments:
Post a Comment