﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-SportyBabe-随笔分类-Java </title><link>http://www.blogjava.net/nina-artemis/category/5311.html</link><description>The opposite of dream</description><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 12:34:08 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 12:34:08 GMT</pubDate><ttl>60</ttl><item><title>Recommended books for Java developers</title><link>http://www.blogjava.net/nina-artemis/archive/2005/12/06/22676.html</link><dc:creator>SportyBabe</dc:creator><author>SportyBabe</author><pubDate>Tue, 06 Dec 2005 02:34:00 GMT</pubDate><guid>http://www.blogjava.net/nina-artemis/archive/2005/12/06/22676.html</guid><wfw:comment>http://www.blogjava.net/nina-artemis/comments/22676.html</wfw:comment><comments>http://www.blogjava.net/nina-artemis/archive/2005/12/06/22676.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/nina-artemis/comments/commentRss/22676.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nina-artemis/services/trackbacks/22676.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Thinking in JavaHead First JavaCore Java 2, Volume 1: FundamentalsPractical JavaEffective Java Programming Language GuideCode CompleteJunit in ActionPatterns of Enterprise Applicat...&nbsp;&nbsp;<a href='http://www.blogjava.net/nina-artemis/archive/2005/12/06/22676.html'>阅读全文</a><img src ="http://www.blogjava.net/nina-artemis/aggbug/22676.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nina-artemis/" target="_blank">SportyBabe</a> 2005-12-06 10:34 <a href="http://www.blogjava.net/nina-artemis/archive/2005/12/06/22676.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>J2SE 5.0 language features</title><link>http://www.blogjava.net/nina-artemis/archive/2005/11/28/21665.html</link><dc:creator>SportyBabe</dc:creator><author>SportyBabe</author><pubDate>Mon, 28 Nov 2005 06:00:00 GMT</pubDate><guid>http://www.blogjava.net/nina-artemis/archive/2005/11/28/21665.html</guid><wfw:comment>http://www.blogjava.net/nina-artemis/comments/21665.html</wfw:comment><comments>http://www.blogjava.net/nina-artemis/archive/2005/11/28/21665.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nina-artemis/comments/commentRss/21665.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nina-artemis/services/trackbacks/21665.html</trackback:ping><description><![CDATA[<P><STRONG>Generics </STRONG><BR><FONT size=2>作用： communicate the element type of a collection to the compiler to avoid the unsafe downcasting.<BR>和C++中parameterized types的作用相似 （在Thinking in java中Bruce Eckel提到过）。<BR></FONT><FONT size=2>Example: ArrayList&lt;String&gt; stringList =&nbsp; new ArrayList&lt;String&gt;();&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;......Add elements to the stringList......<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String string1 = stringList.get(0);</FONT></P>
<P><STRONG>For-each Loop</STRONG> <BR><FONT size=2>作用：if you need not operate the designated elements within the iterator or array, for-each loop will bring the beautiful code for you and reduce the error opportunities.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eliminates the drudgery and error-proneness of iterators and index variables when iterating over collections and arrays.<BR>Example: String[] stringArray;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (String individualString: stringArray) {...}</FONT></P>
<P><FONT size=2>I noticed that most of Russian guys in TopCoder use the for-each loop.</FONT></P>
<P><STRONG>Autoboxing/Unboxing</STRONG> <BR><FONT size=2>作用：automates to box/unbox between primitive types and the appropriate wrapper types.<BR></FONT><FONT size=2>Example:&nbsp; ArrayList&lt;Integer&gt; intList = new ArrayList&lt;Integer&gt;();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int total = intList.get(0);</FONT></P>
<P><STRONG>Typesafe Enums <BR></STRONG><FONT size=2><FONT color=#000000>作用：replace int Enum Pattern (e.g.<STRONG> </STRONG>public static final int XXX = 0;) to represent a fixed set of constants.</FONT><BR></FONT><FONT size=2>Example: public enum&nbsp;WEEKENDS { SAT, SUN };<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private final WEEKENDS weekend;</FONT></P>
<P><STRONG>Varargs </STRONG><BR><FONT size=2>作用：automates and hides the passing process&nbsp;in the case of&nbsp;the arbitrary number of parameters;<BR><FONT size=3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></FONT><FONT size=2>eliminates the need for manually boxing up argument lists into an array when invoking methods that accept variable-length argument lists.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Varargs can be used only in the final argument position.<BR></FONT><FONT size=2>Example: public static String format(String pattern,&nbsp;<FONT color=#000000>Object...</FONT> arguments);</FONT><BR></P>
<P><STRONG>Static Import <BR></STRONG><FONT size=2>作用：avoid qualifying static members with class names without the shortcomings of the "Constant Interface antipattern." <BR>Once the static members have been imported, we don't have to use "ClassName.staticMemeber" in our classes.<BR>Example: import static java.awt.Math.*;&nbsp;<BR></FONT><BR><STRONG>Metadata</STRONG> <BR><FONT size=2>作用：avoid writing boilerplate code by enabling tools to generate it from annotations in the source code.</FONT><BR><FONT size=2>Example: public @interface XXX {...}</FONT></P>
<P><FONT size=2>More information about "J2SE 5.0 new features" could be found at </FONT><A href="http://java.sun.com/j2se/1.5.0/docs/relnotes/features.htm"><FONT size=2>java.sum.com</FONT></A><FONT size=2>.</FONT></P><img src ="http://www.blogjava.net/nina-artemis/aggbug/21665.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nina-artemis/" target="_blank">SportyBabe</a> 2005-11-28 14:00 <a href="http://www.blogjava.net/nina-artemis/archive/2005/11/28/21665.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>