📜  Java.util.LinkedHashSet类

📅  最后修改于: 2020-11-14 06:18:43             🧑  作者: Mango


介绍

java.util.LinkedHashSet类是Set接口的Hash表和Linked list实现,具有可预测的迭代顺序。以下是有关LinkedHashSet的要点-

  • 此类提供所有可选的Set操作,并允许空元素。

类声明

以下是java.util.LinkedHashSet类的声明-

public class LinkedHashSet
   extends HashSet
   implements Set, Cloneable, Serializable

参量

以下是java.util.LinkedHashSet类的参数-

E-这是此集合维护的元素的类型。

类的构造函数

Sr.No. Constructor & Description
1

LinkedHashSet()

This constructs a new, empty linked hash set with the default initial capacity (16) and load factor (0.75).

2

LinkedHashSet(Collection c)

This constructs a new linked hash set with the same elements as the specified collection.

3

LinkedHashSet(int initialCapacity)

This constructs a new, empty linked hash set with the specified initial capacity and the default load factor (0.75).

4

LinkedHashSet(int initialCapacity, float loadFactor)

This constructs a new, empty linked hash set with the specified initial capacity and load factor.

类方法

此类从以下类继承方法-

  • java.util.HashSet
  • java.util.AbstractSet
  • java.util.AbstractCollection
  • java.util.Object
  • java.util.Set