简体   繁体   English

HashTable 和 LinkedList 的 LinkedHashSet 实现?

[英]LinkedHashSet implementations of HashTable and LinkedList?

I came across the below in the JAVA docs related to the LinkedHashSet :我在与LinkedHashSet相关的 JAVA 文档中遇到了以下内容:

Hash table and linked list implementation of the Set interface, with predictable iteration order. Set 接口的哈希表和链表实现,具有可预测的迭代顺序。

But If I see the source of LinkedHashSet I am not able to find any implements/extends related to HashTable or LinkedList .但是,如果我看到LinkedHashSet的来源,我将无法找到任何与HashTableLinkedList相关的implements/extends Then how does it inhibits the features of both these data structures ?那么它是如何抑制这两种data structures的特性的呢?

It does not inherit from those classes, or use them in any way.它不从这些类继承,也不以任何方式使用它们。

But you could write your own linked list class, and it would still be a linked list, even if it had no relationship to java.util.LinkedList .但是您可以编写自己的链表类,它仍然是一个链表,即使它与java.util.LinkedList没有关系。 That's how LinkedHashSet works: it does not use java.util.Hashtable , nor java.util.LinkedList , but it has an implementation of the data structures nonetheless.这就是LinkedHashSet工作原理:它不使用java.util.Hashtable ,也不使用java.util.LinkedList ,但它仍然具有数据结构的实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM