What would you call a collection class which represents a set but where the order matters?
A collection that can have duplicates and where the order matters is called a List.
A collection that can have duplicates and where the order doesn't matter is called a Bag. A collection that cannot have duplicates and where the order doesn't matter is called a Set.What then for the fourth combination; what would you call the class of collection that cannot have duplicates and wh开发者_如何学JAVAere the order matters?
If you can link to an example of your suggested name (the more widely-used the better), please do so.
I would name it an ordered set
How about List-Ordered Set
.
Example: Java's Apache Commons Collections library (class docs) (now obsolete since Java introduced its own LinkedHashSet
class).
精彩评论