国产三级一区,欧洲在线视频一区,天堂资源中文在线http://www.aygfsteel.com/sway/category/35106.html彪悍的人生不需要解釋,彪悍的代碼不需要注釋。zh-cnFri, 07 Nov 2008 08:54:30 GMTFri, 07 Nov 2008 08:54:30 GMT60checkstyle常用的輸出結(jié)果解釋http://www.aygfsteel.com/sway/archive/2008/11/06/238983.htmlKevin.ZhongKevin.ZhongThu, 06 Nov 2008 03:27:00 GMThttp://www.aygfsteel.com/sway/archive/2008/11/06/238983.htmlhttp://www.aygfsteel.com/sway/comments/238983.htmlhttp://www.aygfsteel.com/sway/archive/2008/11/06/238983.html#Feedback0http://www.aygfsteel.com/sway/comments/commentRss/238983.htmlhttp://www.aygfsteel.com/sway/services/trackbacks/238983.html 2“{” should be on the previous line “{” 應(yīng)該位于前一行
3Methos is missing a javadoc comment方法前面缺少javadoc注釋
4Expected @throws tag for “Exception”在注釋中希望有@throws的說(shuō)明
5“.” Is preceeded with whitespace “.” 前面不能有空格
6“.” Is followed by whitespace“.” 后面不能有空格
7“=” is not preceeded with whitespace“=” 前面缺少空格
8“=” is not followed with whitespace“=” 后面缺少空格
9“}” should be on the same line“}” 應(yīng)該與下條語(yǔ)句位于同一行
10Unused @param tag for “unused”沒(méi)有參數(shù)“unused”,不需注釋
11Variable “CA” missing javadoc變量“CA”缺少javadoc注釋
12Line longer than 80characters行長(zhǎng)度超過(guò)80
13Line contains a tab character行含有”tab” 字符
14Redundant “Public” modifier冗余的“public” modifier
15Final modifier out of order with the JSL suggestionFinal modifier的順序錯(cuò)誤
16Avoid using the “.*” form of importImport格式避免使用“.*”
17Redundant import from the same package從同一個(gè)包中Import內(nèi)容
18Unused import-java.util.listImport進(jìn)來(lái)的java.util.list沒(méi)有被使用
19Duplicate import to line 13重復(fù)Import同一個(gè)內(nèi)容
20Import from illegal package從非法包中 Import內(nèi)容
21“while” construct must use “{}”“while” 語(yǔ)句缺少“{}”
22Variable “sTest1” must be private and have accessor method變量“sTest1”應(yīng)該是private的,并且有調(diào)用它的方法
23Variable “ABC” must match pattern “^[a-z][a-zA-Z0-9]*$”變量“ABC”不符合命名規(guī)則“^[a-z][a-zA-Z0-9]*$”
24“(” is followed by whitespace“(” 后面不能有空格 25“)” is proceeded by whitespace“)” 前面不能有空格

Kevin.Zhong 2008-11-06 11:27 發(fā)表評(píng)論
]]>
利用Ecipse生成Javadoc亂碼解決方法http://www.aygfsteel.com/sway/archive/2008/11/05/238822.htmlKevin.ZhongKevin.ZhongWed, 05 Nov 2008 06:53:00 GMThttp://www.aygfsteel.com/sway/archive/2008/11/05/238822.htmlhttp://www.aygfsteel.com/sway/comments/238822.htmlhttp://www.aygfsteel.com/sway/archive/2008/11/05/238822.html#Feedback0http://www.aygfsteel.com/sway/comments/commentRss/238822.htmlhttp://www.aygfsteel.com/sway/services/trackbacks/238822.html 1)  -encoding charsetName
2) -charset charsetName

第一個(gè)參數(shù)表示javadoc 程序讀取java源文件時(shí)候應(yīng)該采用什么編碼
第二個(gè)參數(shù)表示javadoc 程序?qū)慼tml文件時(shí)采用的編碼形式,并會(huì)在HTML中加入如下標(biāo)簽

 網(wǎng)管下載dl.bitscn.com

1 <! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" >
2 <!-- NewPage -->
3 < HTML >
4 < HEAD >
5 <!--  Generated by javadoc (build 1.5.0) on Thu Feb 01 21:10:10 CST 2007  --> 
6 <!-- -這下面的charset隨編碼的不同而不同,這里面為utf-8編碼-- -->
7 < META  http-equiv ="Content-Type"  content ="text/html; charset=utf-8" >

如果文件格式為UTF8格式的,可以采用如下形式進(jìn)行Generate Javadoc:
javadoc  -encoding UTF-8 -charset UTF-8 <other params>

Kevin.Zhong 2008-11-05 14:53 發(fā)表評(píng)論
]]>
ArrayList 使用默認(rèn)構(gòu)造函數(shù)時(shí),其預(yù)設(shè)置的數(shù)組大小是多少?http://www.aygfsteel.com/sway/archive/2008/10/10/233538.htmlKevin.ZhongKevin.ZhongFri, 10 Oct 2008 03:15:00 GMThttp://www.aygfsteel.com/sway/archive/2008/10/10/233538.htmlhttp://www.aygfsteel.com/sway/comments/233538.htmlhttp://www.aygfsteel.com/sway/archive/2008/10/10/233538.html#Feedback0http://www.aygfsteel.com/sway/comments/commentRss/233538.htmlhttp://www.aygfsteel.com/sway/services/trackbacks/233538.html
ArrayList 默認(rèn)的大小為 10

ArrayList源代碼:

/**
* Constructs an empty list with an initial capacity of ten.
*/

public ArrayList() {

this(10);

}
HashSet默認(rèn)大小與HashMap一樣 為 16 (因?yàn)镠ashSet就是使用HashMap的key來(lái)保存對(duì)象)

HashMap源代碼:

static final int DEFAULT_INITIAL_CAPACITY = 16;

/**
* Constructs an empty <tt>HashMap</tt> with the default initial capacity
* (16) and the default load factor (0.75).
*/

public HashMap() {

this.loadFactor = DEFAULT_LOAD_FACTOR;

threshold 
= (int)(DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR);

table 
= new Entry[DEFAULT_INITIAL_CAPACITY];

init();

}



Kevin.Zhong 2008-10-10 11:15 發(fā)表評(píng)論
]]>
使用Eclipse 3.3插件生成hashCode方法的陷阱 http://www.aygfsteel.com/sway/archive/2008/10/10/233528.htmlKevin.ZhongKevin.ZhongFri, 10 Oct 2008 02:52:00 GMThttp://www.aygfsteel.com/sway/archive/2008/10/10/233528.htmlhttp://www.aygfsteel.com/sway/comments/233528.htmlhttp://www.aygfsteel.com/sway/archive/2008/10/10/233528.html#Feedback0http://www.aygfsteel.com/sway/comments/commentRss/233528.htmlhttp://www.aygfsteel.com/sway/services/trackbacks/233528.html先來(lái)解釋一下hashCode這個(gè)方法的作用: - (摘自JDK docs)
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.
從注釋上可以知道,hashCode可用于如Hashtable,HashMap這些集合對(duì)象,它通過(guò)hashCode對(duì)集合中的元素進(jìn)行
散列處理,這樣在查找時(shí),通過(guò)hashCode可以很迅速的進(jìn)行對(duì)象的查找操作。

However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables.
但是每位PG需要知道,如果不對(duì)Object的hashCode對(duì)象復(fù)寫(xiě),則其它生成規(guī)則是根據(jù)內(nèi)部的指針地址來(lái)算出hashCode。(這一點(diǎn)大家得特別注意)

下面是eclipse生成代碼的一個(gè)示例:

public int hashCode() {

final int prime = 31;

int result = super.hashCode();

result 
= prime * result + ((name == null? 0 : name.hashCode());

return result;

}

它的問(wèn)題就是,result中調(diào)用了 *super.hashCode()。*這么一來(lái),同一個(gè)類被實(shí)例化多次后,雖然它們的名稱都相同
但生成的hashCode都不同,當(dāng)然在那些集合類中使用返回的也會(huì)有問(wèn)題了。



Kevin.Zhong 2008-10-10 10:52 發(fā)表評(píng)論
]]>
主站蜘蛛池模板: 元阳县| 潜江市| 柯坪县| 中阳县| 九龙城区| 阜城县| 双城市| 张家港市| 孝感市| 克什克腾旗| 桂东县| 延津县| 平和县| 玉环县| 霍林郭勒市| 安多县| 平南县| 新野县| 佛学| 马山县| 邯郸县| 乐至县| 台南市| 巴林右旗| 五峰| 翼城县| 随州市| 增城市| 禄丰县| 宕昌县| 铁岭市| 郑州市| 安溪县| 广昌县| 禹城市| 阜阳市| 涿州市| 贡嘎县| 宝兴县| 云和县| 潞西市|