开发者

What would you call a collection class which represents a set but where the order matters?

开发者 https://www.devze.com 2023-03-14 17:08 出处:网络
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 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).

0

精彩评论

暂无评论...
验证码 换一张
取 消