首页 \ 问答 \ HashSet和LinkedHashSet(HashSet vs LinkedHashSet)

HashSet和LinkedHashSet(HashSet vs LinkedHashSet)

他们有什么区别? 我知道

LinkedHashSet是HashSet的有序版本,它保留所有元素之间的双向链接列表。 当您关心迭代顺序时,请使用此类而不是HashSet。 当您遍历HashSet时,该顺序是不可预测的,而LinkedHashSet允许您按照插入顺序遍历元素。

但是在LinkedHashSet的源代码中,只有调用HashSet的构造函数。 那么双链列表和插入顺序在哪里?


What is the difference between them? I know that

A LinkedHashSet is an ordered version of HashSet that maintains a doubly-linked List across all elements. Use this class instead of HashSet when you care about the iteration order. When you iterate through a HashSet the order is unpredictable, while a LinkedHashSet lets you iterate through the elements in the order in which they were inserted.

But in sourcecode of LinkedHashSet there are only calling constructors of HashSet. So where is double-linked List and insertion order?


原文:https://stackoverflow.com/questions/5080612
更新时间:2023-11-18 13:11

最满意答案

边框已经在生成的trtd元素上设置,而不是在table 。 所以,这应该做:

.companyHeaderGrid.ui-panelgrid>*>tr,
.companyHeaderGrid.ui-panelgrid .ui-panelgrid-cell {
    border: none;
}

我怎么找到了 只需检查生成的HTML输出和Chrome开发工具集中的所有CSS样式规则(右键单击检查元素或按F12)。 Firebug和IE9有一个类似的工具集。 至于混淆,请记住,JSF / Facelets最终会生成HTML,而CSS仅适用于HTML标记,而不适用于JSF源代码。 所以要应用/ finetune CSS,你需要查看客户端(webbrowser)方面。

在此输入图像说明

也可以看看:

  • 如何用自定义样式覆盖默认的PrimeFaces CSS?
  • 从所有PrimeFaces p:panelGrid组件中删除边框

如果您仍然使用PrimeFaces 4或更旧版本,请使用以下代码:

.companyHeaderGrid.ui-panelgrid>*>tr,
.companyHeaderGrid.ui-panelgrid>*>tr>td {
    border: none;
}

The border is been set on the generated tr and td elements, not on the table. So, this should do:

.companyHeaderGrid.ui-panelgrid>*>tr,
.companyHeaderGrid.ui-panelgrid .ui-panelgrid-cell {
    border: none;
}

How I found it? Just check the generated HTML output and all CSS style rules in the webdeveloper toolset of Chrome (rightclick, Inspect Element or press F12). Firebug and IE9 have a similar toolset. As to the confusion, just keep in mind that JSF/Facelets ultimately generates HTML and that CSS only applies on the HTML markup, not on the JSF source code. So to apply/finetune CSS you need to look in the client (webbrowser) side instead.

enter image description here

See also:


If you're still on PrimeFaces 4 or older, use below instead:

.companyHeaderGrid.ui-panelgrid>*>tr,
.companyHeaderGrid.ui-panelgrid>*>tr>td {
    border: none;
}

相关问答

更多