TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Hidden Features of Java

125 点作者 zengr超过 13 年前

5 条评论

ntkachov超过 13 年前
Java.util.concurrent is one of the most attractive features of java for server programming. ConcurrentHashMap is faster, cleaner and much easier to use than locking every time you need a access a shared HashMap. Not only that but it doesn't lock the entire hash, just a partition of what ever you will be accessing.<p>Also AtomicInt,Float,Long make life easier when dealing with threaded programs.
评论 #3439749 未加载
评论 #3439963 未加载
theon144超过 13 年前
&#62;closed as not constructive by Robert Harvey♦ Oct 5 '11 at 5:49<p>&#62;This question is not a good fit to our Q&#38;A format. We expect answers to generally involve facts, references, or specific expertise; this question will likely solicit opinion, debate, arguments, polling, or extended discussion.<p>I appreciate StackOverflow's active moderators, but this question was actually pretty interesting. What harm would it do to let the question open?
评论 #3439885 未加载
评论 #3439713 未加载
评论 #3439822 未加载
评论 #3441361 未加载
评论 #3439731 未加载
评论 #3439971 未加载
Ubersoldat超过 13 年前
<a href="http://monocaffe.blogspot.com/2011/10/javas-ghost-jvms.html" rel="nofollow">http://monocaffe.blogspot.com/2011/10/javas-ghost-jvms.html</a><p>"how does tools like JPS, JConsole or VisualVM know the JVMs running in a system? They simply look in the folder /tmp/hsperfdata_foo where a 32KB data file with the PID as name is created for each JVM."<p>Not a hidden feature of Java, but of Sun's (Oracle) JVM which I'm not sure if happens in other JVMs but it's kind of useful for doing different stuff.
jahnu超过 13 年前
The example in the linked ThreadLocal documentation appears to have a mistake.<p>In getCurrentThreadId it should read<p>return uniqueNum.get();<p>not<p>return uniqueId.get();
6ren超过 13 年前
My preferred initialization for lists of strings (shorter than the anon class + instance init e.g.)<p><pre><code> List&#60;String&#62; fruits = Arrays.asList("apple,orange,pear".split(","));</code></pre>
评论 #3442403 未加载