??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美日韩美女视频,中文字幕在线观看亚洲,fc2在线中文字幕http://www.aygfsteel.com/suker/zh-cnFri, 20 Jun 2025 00:05:50 GMTFri, 20 Jun 2025 00:05:50 GMT60java 集合cLȝ(?http://www.aygfsteel.com/suker/archive/2009/08/14/291165.htmlsukersukerFri, 14 Aug 2009 07:22:00 GMThttp://www.aygfsteel.com/suker/archive/2009/08/14/291165.htmlhttp://www.aygfsteel.com/suker/comments/291165.htmlhttp://www.aygfsteel.com/suker/archive/2009/08/14/291165.html#Feedback0http://www.aygfsteel.com/suker/comments/commentRss/291165.htmlhttp://www.aygfsteel.com/suker/services/trackbacks/291165.html阅读全文

suker 2009-08-14 15:22 发表评论
]]>
java 集合cLȝ(?http://www.aygfsteel.com/suker/archive/2009/08/14/291164.htmlsukersukerFri, 14 Aug 2009 07:18:00 GMThttp://www.aygfsteel.com/suker/archive/2009/08/14/291164.htmlhttp://www.aygfsteel.com/suker/comments/291164.htmlhttp://www.aygfsteel.com/suker/archive/2009/08/14/291164.html#Feedback0http://www.aygfsteel.com/suker/comments/commentRss/291164.htmlhttp://www.aygfsteel.com/suker/services/trackbacks/291164.html遍历 vs. 查找

遍历和修改似乎是一对矛盾,一个可以高效率插入删除元素的数据结构通常遍历的性能q不是最优。于? JCF在这里根据用L目标实现了两U定制的数据l构Q?/span>

哈希表(包括HashSet和HashMapQ和q二叉树(包括TreeSet? TreeMapQ?/span>

׃可排序性是一U独特的要求Q所以引入了SortedSet和SortedMapQ它们分别是AbstractSet? AbstractMap的子接口Q而TreeSet和TreeMap又分别是他们的一U实现。熟悉数据结构的人可能比较了解,哈希表在q行插入、删除、查 找这L操作是很快的Q其旉复杂度是常数UO(1)Q^衡二叉树虽然插入、删除操作比较麻烦(需要O(log n)的代PQ但q行遍历和排序却很快。选择完全在于用户的侧重点Q但׃cd转换的方便性,通常我们用哈希表构造一个集合以后,再把它{换成相应的树? q行遍历Q以获得较好的效果?/span>

历史实现 vs. 新实?/span>

    历史实现QLegacy ImplementationsQ是JCF的一个术语,准确的意义不是很清楚Q但大致可以认ؓ在Java 2QJDK 1.2Q出C前的老版本中JCF的一个雏形框架。在Java 2以后QJCF才开始完善健壮v来,新实C出现了一些新的类用于替代老版本中的成员,但由于种U原因,老版本中很多c都代表了传l数据结构的_N部分Q? 以及一些安全原因,所以仍然被我们使用着?br />
Enumeration vs. Iterator
    Enumeration是一个传l的集合遍历工具Q在新的JCF中用的是IteratorQIterator同样h遍历功能Q还包含一?/span>remove()Ҏ来删除当前得到的元素?br />
Dictionary vs. Map
    Dictionary 是一个现在已l被标记为deprecated的类Q实C老版本中的映功能,现在已经完全被Map取代。它们的区别是:Dictionary中key? value不能为nullQ但Map却允许空的关键字和|q一点直接媄响到它们的后代:Hashtable和HashMap?br />
Vector vs. ArrayList
    Vector 和ArrayList是数l在JCF中的体现Q还记得前面讲过的数l的~点么?Vector和ArrayList是一U可以动态增长的数组? Vector是历史实玎ͼ它和ArrayList的主要区别在于,Vector是同步集合(或者说是线E安全的Q,但ArrayListq不是同步的Q由 于同步需要花一定的代hQ所以ArrayList看v来要比Vector的存取访问效率更高。关于同步我们下面还要谈到?br />
Hashtable vs. HashMap
    Hashtable 是Dictionary的子c,属于历史实现Q而HashMap是Map的子c,是新实现。它们的区别除了上面所说的key和value是否可以为空? 外,也有同步的差别,Hashtable是同步的Q但HashMap不是。HashMap的一个经典的例子是JSP的内|对象session。不q不? 因ؓHashtable?#8220;老前?#8221;而瞧不v它哦Q它的一个著名的子类Properties我们可是l常会用到的?/span>

同步 vs. 不同?/span>

    从上面的描述中我们似乎可以得么一个印象:历史实现好像都是同步的,但新实现中却 没有。需要同步操作的理由是,可能存在多个U程对同一个集合进行操作的情况Q譬如一个线E正在对某集合进行遍历,但与此同Ӟ另一个线E又在对该集合进? 插入或删除,那么W一个线E的遍历l果是不可预测的,对于同步集合Q它会抛出一?/span>ConcurrentModificationException异常QJCF把这U机制成?#8220;fail-fast”。我们对比一下Vector和ArrayList的源代码可以发现Vector的很多方法都是有synchronized关键字修饰的Q但ArrayList没有?/span>

Ҏ遗忘的工PCollections?/span>Arrays

    在图1中右下角落里有两个类叫做CollectionsQ注意,不是 CollectionQ)和ArraysQ这是JCF里面功能强大的工P但初学者往往会忽视。按JCF文档的说法,q两个类提供了封装器实现 QWrapper ImplementationsQ、数据结构算法和数组相关的应用?br />     惛_大家不会忘记上面谈到?#8220;折半查找”?#8220;排序”{经典算法吧QCollectionscL供了丰富的静态方法帮助我们轻村֮成这些在数据l构课上烦h的工作:

binarySearchQ折半查找?br /> sortQ排序,q里是一U类g快速排序的ҎQ效率仍然是O(n * log n)Q但却是一U稳定的排序Ҏ?br /> reverseQ将U性表q行逆序操作Q这个可是从前数据结构的l典考题哦!
rotateQ以某个元素u心将U性表“旋{”——哇Q这个功能太酷了Q?br /> swapQ交换一个线性表中两个元素的位置?br /> ……

    Collectionsq有一个重要功能就?#8220;装?#8221;QWrapperQ,它提供了一些方法可以把一个集合{换成一个特D的集合Q?br />
unmodifiableXXXQ{换成只读集合Q这里XXX代表六种基本集合接口QCollection、List、Map、Set、SortedMap和SortedSet。如果你对只读集合进行插入删除操作,会抛出
UnsupportedOperationException异常?br /> synchronizedXXXQ{换成同步集合?br /> singletonQ创Z个仅有一个元素的集合Q这里singleton生成的是单元素SetQ?/span>singletonList?/span>singletonMap分别生成单元素的List和Map?br /> I集Q由Collections的静态属?/span>EMPTY_SET?/span>EMPTY_LIST?/span>EMPTY_MAP表示?br />
    此外Q我们知道把集合转换成对象数l可以用Collection?/span>toArray()ҎQ我们也可以方便地把一个对象数l{换成一个线性表Q可不要告诉我你是一个一个地add哦)QArrays.asList()?/span>

泛型

    目前我们了解的JCF的一个重要特征是Q所有加入到集合当中的对象都在表面上失d 们自qҎ,而看上去仅仅只是一个Object对象而已Q除非你把它强制cd转换成它们原来的对象。这一点很自然Q集合嘛Q对象的容器Q它容纳的是各种 各样的对象,而不仅仅是某U特定类型的对象。J2SE 5.0出现以后QJCF开始引入泛型的Ҏ,譬如我们l常到q样的应用,是把集合{换成特定的数l,虽然Collection有toArray()? ҎQ但可惜的是Q这个数l的所有元素都是Objectcd的,我们通常的做法是用一个for循环把数l的每个元素都进行强制类型{换,虽然可行Q但看上 dW拙Q如果有了泛型,我们可以预先指定要得到的类型,然后一ơtoArray可以得到我们期望的数组Q里面的元素全部都是指定cd了。惭愧的是, 我对5.0q不是太了解Q具体可以参?/span>J2SE 5.0的JCF文档?



suker 2009-08-14 15:18 发表评论
]]>
java集合cLȝQ一Q?/title><link>http://www.aygfsteel.com/suker/archive/2009/08/14/291162.html</link><dc:creator>suker</dc:creator><author>suker</author><pubDate>Fri, 14 Aug 2009 07:13:00 GMT</pubDate><guid>http://www.aygfsteel.com/suker/archive/2009/08/14/291162.html</guid><wfw:comment>http://www.aygfsteel.com/suker/comments/291162.html</wfw:comment><comments>http://www.aygfsteel.com/suker/archive/2009/08/14/291162.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/suker/comments/commentRss/291162.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/suker/services/trackbacks/291162.html</trackback:ping><description><![CDATA[<p>也算做了几年java?好多东西都没有梳理过.今天梳理哈集合c?</p> <p>整体框架:</p> <p><img src="http://sukerinwh.blogbus.com/files/12498685590.gif" alt="" border="0" /></p> <p>单记?</p> <p><img src="http://sukerinwh.blogbus.com/files/12498687790.gif" alt="" border="0" /></p> <p><span style="color: #0000ff;"><span style="font-size: x-small;"><span style="font-family: 宋体;">Set</span></span></span><span style="font-family: 宋体; font-size: x-small;">接口代表无序Q它是不允许有重复元素出现的Q?/span></p> <p><span style="color: #0000ff;"><span style="font-size: x-small;"><span style="font-family: 宋体;">List</span></span></span><span style="font-family: 宋体; font-size: x-small;">接口表示有序Q?/span></p> <p><span style="font-family: 宋体; font-size: x-small;">?/span><span style="color: #0000ff;"><span style="font-size: x-small;"><span style="font-family: 宋体;">Map</span></span></span><span style="font-family: 宋体; font-size: x-small;">接口表示映射</span></p> <p> </p> <p><img src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/moz-screenshot.png" alt="" /></p> <table border="0"> <tbody> <tr> <td colspan="5" valign="top" width="484"> <p align="center"><span style="font-family: 宋体; font-size: x-small;">集合框架的祖宗: </span><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">Collection</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td valign="top" width="118"> <p align="center"><span style="font-family: 宋体; font-size: x-small;">历史集合 </span></p> </td> <td colspan="4" valign="top" width="398"> <p align="center"><span style="font-family: 宋体; font-size: x-small;">新集?</span></p> </td> </tr> <tr> <td colspan="2" valign="top" width="195"> <p align="center"><span style="font-family: 宋体; font-size: x-small;">无序集: </span><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">Set</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td colspan="3" valign="top" width="289"> <p align="center"><span style="font-family: 宋体; font-size: x-small;">有序集: </span><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">List</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td valign="top" width="118"> <p align="center"><span style="font-family: 宋体; font-size: x-small;">映射Q?/span><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">Dictionary</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td colspan="4" valign="top" width="398"> <p align="center"><span style="font-family: 宋体; font-size: x-small;">映射Q?/span><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">Map</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> </tr> <tr> <td rowspan="2" valign="top" width="101"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">AbstractSet</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td rowspan="2" valign="top" width="94"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">SortedSet</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td colspan="2" valign="top" width="147"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">AbstractList</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td valign="top" width="143"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">AbstractSequentialList</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td rowspan="3" valign="top" width="118"> <p align="center"><br /> <br /> <br /> <a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">Hashtable</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td colspan="3" valign="top" width="321"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">AbstractMap</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td valign="top" width="77"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">SortedMap</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> </tr> <tr> <td valign="top" width="78"> <p align="center"><span style="font-family: 宋体; font-size: x-small;">历史集合 </span></p> </td> <td valign="top" width="69"> <p align="center"><span style="font-family: 宋体; font-size: x-small;">新集?</span></p> </td> <td rowspan="2" valign="top" width="143"> <p align="center"><br /> <br /> <a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">LinkedList</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td rowspan="2" valign="top" width="100"> <p align="center"><br /> <br /> <a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">WeakHashMap</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td rowspan="2" valign="top" width="112"> <p align="center"><br /> <br /> <a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">IdentityHashMap</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td rowspan="2" valign="top" width="109"> <p align="center"><br /> <br /> <a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">HashMap</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td rowspan="2" valign="top" width="77"> <p align="center"><br /> <br /> <a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">TreeMap</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> </tr> <tr> <td valign="top" width="101"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">HashSet</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td valign="top" width="94"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">TreeSet</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td valign="top" width="78"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">Vector</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td valign="top" width="69"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">ArrayList</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> </tr> <tr> <td valign="top" width="101"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">LinkedHashSet</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td valign="top" width="94"><span style="font-family: 宋体; font-size: x-small;"> </span></td> <td valign="top" width="78"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">Stack</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td valign="top" width="69"><span style="font-family: 宋体; font-size: x-small;"> </span></td> <td valign="top" width="143"><span style="font-family: 宋体; font-size: x-small;"> </span></td> <td valign="top" width="118"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">Properties</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> <td valign="top" width="100"><span style="font-family: 宋体; font-size: x-small;"> </span></td> <td valign="top" width="112"><span style="font-family: 宋体; font-size: x-small;"> </span></td> <td valign="top" width="109"> <p align="center"><a target="_blank"><span style="font-family: 宋体; color: #0000ff; font-size: x-small;">LinkedHashMap</span></a><span style="font-family: 宋体; font-size: x-small;"> </span></p> </td> </tr> </tbody> </table> <p> </p> <img src ="http://www.aygfsteel.com/suker/aggbug/291162.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/suker/" target="_blank">suker</a> 2009-08-14 15:13 <a href="http://www.aygfsteel.com/suker/archive/2009/08/14/291162.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>与ant有关Q二Q?/title><link>http://www.aygfsteel.com/suker/archive/2009/08/14/291161.html</link><dc:creator>suker</dc:creator><author>suker</author><pubDate>Fri, 14 Aug 2009 07:11:00 GMT</pubDate><guid>http://www.aygfsteel.com/suker/archive/2009/08/14/291161.html</guid><wfw:comment>http://www.aygfsteel.com/suker/comments/291161.html</wfw:comment><comments>http://www.aygfsteel.com/suker/archive/2009/08/14/291161.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/suker/comments/commentRss/291161.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/suker/services/trackbacks/291161.html</trackback:ping><description><![CDATA[<p> 上文提到jdk1.5的编译的class转成1.4的问?上网找了?如下:</p> <p><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning /> <w:DrawingGridVerticalSpacing>7.8 ?/w:DrawingGridVerticalSpacing> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:SpaceForUL /> <w:BalanceSingleByteDoubleByteWidth /> <w:DoNotLeaveBackslashAlone /> <w:ULTrailSpace /> <w:DoNotExpandShiftReturn /> <w:AdjustLineHeightInTable /> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:UseFELayout /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles deflockedstate="false" latentstylecount="156"> </w:LatentStyles> </xml><![endif]--><!--[if !mso]> <span id="wmqeeuq" class="mceItemObject" classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id="ieooui"> </span> <mce:style><! st1\:*{behavior:url(#ieooui) } --> <!--[endif]--> <!--[if gte mso 10]> <mce:style><! /* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表? mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} --> <!--[endif]--> </p> <p class="MsoNormal"><span lang="EN-US">FROM :http://hi.baidu.com/monkeyhoop/blog/item/d215dcecb861284878f0559f.html<br /> <br /> </span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">使用</span><span lang="EN-US"> UE </span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">打开</span><span lang="EN-US"> class </span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">文gQ第一行内容:</span><span lang="EN-US"><br /> <br /> 00000000h: CA FE BA BE <span style="color: red;" mce_style="color: red;">00 00 00 32</span> 00 A9 07 00 02 01 00 37 ; </span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">漱壕</span><span lang="EN-US">...2.?....7<br /> <br /> </span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">前四个字节ؓ固定?/span><span lang="EN-US"> CA FE BA BE </span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">Q接下来的四个字节ؓơ版本号Q?/span><span lang="EN-US">0000</span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">Q和ȝ本号Q?/span><span lang="EN-US">00032</span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">Q?/span><span lang="EN-US"><br /> <br /> 32</span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">Q?/span><span lang="EN-US">JDK1.6<br /> 31</span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">Q?/span><span lang="EN-US">JDK1.5<br /> 30</span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">Q?/span><span lang="EN-US">JDK1.4<br /> 2F</span><span style="font-family: 宋体;" mce_style="font-family: 宋体;">Q?/span><span lang="EN-US">JDK1.3</span></p> <p class="MsoNormal"><br /> </p> <p class="MsoNormal"><span lang="EN-US">http://www.aygfsteel.com/Unmi/articles/124166.html</span></p> <p class="MsoNormal"><span lang="EN-US">上文提到?一个叫</span><span style="background-color: #ffffff;" mce_style="background-color: #ffffff;"><span style="color: #000000;" mce_style="color: #000000;"><a id="viewpost1_TitleUrl" href="../../Unmi/archive/2007/05/17/124166.html" mce_href="http://www.aygfsteel.com/Unmi/archive/2007/05/17/124166.html">Retrotranslator</a></span></span> 的东?实好用 谢谢作者的辛苦力_.下一步{向修改jdkbug的研I?与ant有关(一)).</p> <p><br /> </p> <p><br /> </p> <img src ="http://www.aygfsteel.com/suker/aggbug/291161.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/suker/" target="_blank">suker</a> 2009-08-14 15:11 <a href="http://www.aygfsteel.com/suker/archive/2009/08/14/291161.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>与ant有关Q一Q?/title><link>http://www.aygfsteel.com/suker/archive/2009/08/14/291159.html</link><dc:creator>suker</dc:creator><author>suker</author><pubDate>Fri, 14 Aug 2009 07:09:00 GMT</pubDate><guid>http://www.aygfsteel.com/suker/archive/2009/08/14/291159.html</guid><wfw:comment>http://www.aygfsteel.com/suker/comments/291159.html</wfw:comment><comments>http://www.aygfsteel.com/suker/archive/2009/08/14/291159.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/suker/comments/commentRss/291159.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/suker/services/trackbacks/291159.html</trackback:ping><description><![CDATA[<p> 来到新公?,一切都q算习惯.好久没怎么写代? q几天没什么Q?做个工具方便打补丁包. 和同事沟通了?单的说就是想做个自动~译java,q且打包的工?以前用过点ant,于是q它了.大概写了哈脚?</p> <p>环境如下: ant1.7</p> <p>             jdk 1.42</p> <p>不过很不?~译大概3000多个文g.q程中出C2个问?</p> <p>1 out of memory 解决方式:在build.xml?lt;javac>指定memoryMaximumSize="1024m".问题解决.</p> <p>2 stackoverflow 开始感觉的是在eclipse ?指定-Xss=100m.q个是指定堆栈的大小,不过问题q是存在.</p> <p>异常如下:</p> <p>    [javac] Compiling 2230 source files to D:\60work\xyg60\test<br />     [javac] The system is out of resources.<br />     [javac] Consult the following stack trace for details.<br />     [javac] java.lang.StackOverflowError<br />     [javac]     at com.sun.tools.javac.v8.comp.Attr.visitApply(Attr.java:689)<br />     [javac]     at com.sun.tools.javac.v8.tree.Tree$Apply.accept(Tree.java:877)<br />     [javac]     at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:198)<br />     [javac]     at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java:1071)<br />     [javac]     at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java:1091)<br />     [javac]     at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:198)</p> <p>   ....................................................................................................</p> <p>上网查了?发现是sun的一个bug:http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6623981</p> <p>单描q如?</p> <pre>1.The cause of StackOverFlowError<br /> <br /> When compiling a source(javac ... *.java), the classes depending on<br /> the compiled source become translation objects if not existing on<br /> classpath. There is a max limit of source/class number set to be 502<br /> when analyzing a source code. Analytical information that javac holds<br /> internally grows to translate a huge amount of source program at a<br /> time and that results in a stack overflow.<br /> <br /> 2.Why the option "-J-Xss10m" did not work<br /> <br /> The thread where stack overflow occurred was generated by OS when<br /> starting javac.exe. Its size was fixed to be 256KB on Windows so<br /> "-J-Xss10m" did not work. This option is valid only for the threads<br /> generated by Java VM.<br /> <br /> To solve the problem, one way is not to make a recursive call in the<br /> processing of javac. <br /> <br /> This problem was not seen in jdk 5.0.<br /> Posted Date : 2007-10-31 03:57:57.0<br /> <br /> Test case and instruction for reproduction has been added.<br /> Please see Comment section.<br /> Posted Date : 2007-11-27 10:13:04.0<br /> <span><strong>Evaluation</strong></span> :<br /> Fixing by starting the javac "work" in a new thread, to avoid any possible limitation of the primordial thread stack size by the OS. <br /> This applies to 5.0 and earlier, later JDKs have the launcher start the application in a new thread.<br /> Posted Date : 2008-08-25 19:28:25.0<br /> 可恨的sun 竟然搞到1.5的update17才解?<br /> 下了个最新的jdk1.5update20 问题解决?<br /> ׃我打包的东东是要在jdk1.4中运行的.q要x办法?.5的class 转换?.4?....<br /> 或者可以自׃?.4的jdk.按照他的<span><strong>Evaluation</strong></span> ,来改jdk q个攑ֈ有时间在?<br /> <br /> <br /> </pre> <br /> <br /> <br /> <img src ="http://www.aygfsteel.com/suker/aggbug/291159.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/suker/" target="_blank">suker</a> 2009-08-14 15:09 <a href="http://www.aygfsteel.com/suker/archive/2009/08/14/291159.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">С</a>| <a href="http://" target="_blank">̨ɽ</a>| <a href="http://" target="_blank">ɳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̩</a>| <a href="http://" target="_blank">¤</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ӧ</a>| <a href="http://" target="_blank">°Ͷ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ʡ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ĵʡ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̶</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank">̨</a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">֦</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ȫ</a>| <a href="http://" target="_blank">˰</a>| <a href="http://" target="_blank">̨</a>| <a href="http://" target="_blank">᯹</a>| <a href="http://" target="_blank">㰲</a>| <a href="http://" target="_blank">ˮ</a>| <a href="http://" target="_blank">崲</a>| <a href="http://" target="_blank">ξ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>