→Java関連
→Javaのリフレクション
→Java文法系Tips
→Eclipse関連
→JavaのWebアプリ開発
サブトピック†
Tips集Webサイト†
並行処理†
JavaのSerializableを実際にアプリケーションを動かしながら理解する†
util.Objects†
日付/時刻処理いろいろ†
Runtime#addShutdownHookで JVM 終了時に処理を実行する†
Velocity†
マルチスレッド†
強制ガベージコレクション†
- System.gc() もしくは Runtime.getRuntime().gc()
BigDecimalの丸め方†
ファイル一覧取得†
Java のスタンドアロンプログラムで終了コードを設定するには†
System.exit(-1);
PDFを生成する†
XMLに対応したProperties†
シリアルバージョンUIDの生成†
実行時の対応ソース行取得†
int line = (new Throwable().getStackTrace()[0]).getLineNumber();
Javaオブジェクトのハッシュコードのルール†
- The hashCode( ) method is supposed to return an int that should uniquely identify different objects.
- A properly written hashCode( ) method will follow these rules:
- It is repeatable: hashCode(x) must return the same int when called repeatedly, unless set methods have been called.
- It is consistent with equality: if x.equals(y), then x.hashCode( ) must == y.hashCode( ).
- If !x.equals(y), it is not required that x.hashCode( ) != y.hashCode( ), but doing so may improve performance of hash tables; i.e., hashes may call hashCode( ) before equals( ).
- The default hashCode( ) on Sun's JDK returns a machine address, which conforms to Rule 1. Conformance to Rules 2 and 3 depends, in part, upon your equals( ) method. Here is a program that prints the hashcodes of a small handful of objects:
コンパイラの警告抑制†
バイト配列から文字列への変換†
result = new String(bytes, offset, length, charsetName);
- charsetName は "shift-jis"とか
Javaのソース解析/AST(Abstract Syntax Tree)†
その他†