Java 的隐藏特性 [英] Hidden Features of Java
问题描述
阅读C#的隐藏特性后,我想知道,C#的一些隐藏特性是什么?爪哇?
After reading Hidden Features of C# I wondered, What are some of the hidden features of Java?
推荐答案
双括号初始化 几个月前当我第一次发现它时让我大吃一惊,之前从未听说过.
Double Brace Initialization took me by surprise a few months ago when I first discovered it, never heard of it before.
ThreadLocals 通常不是这样广为人知的一种存储每线程状态的方法.
ThreadLocals are typically not so widely known as a way to store per-thread state.
由于 JDK 1.5 Java 除了锁之外还有非常好的实现和健壮的并发工具,它们位于 java.util.concurrent 一个特别有趣的例子是 java.util.concurrent.atomic 子包,其中包含实现 compare-and-swap 操作并且可以映射到实际的本地硬件支持版本这些操作.
Since JDK 1.5 Java has had extremely well implemented and robust concurrency tools beyond just locks, they live in java.util.concurrent and a specifically interesting example is the java.util.concurrent.atomic subpackage that contains thread-safe primitives that implement the compare-and-swap operation and can map to actual native hardware-supported versions of these operations.
这篇关于Java 的隐藏特性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!