LoginSignup
0
1

More than 5 years have passed since last update.

Effective Java 6章34~35

Posted at

6章.ENUMとアノテーション

34.intの定数の代わりにenumを使うべし

  • enumをいつ使えばよいか?→コンパイル時に明らかになっている定数のセットが必要な時はいつでも!
  • constant-specific methodは馴染みがなくてしっくりこなかった。。以下の説明が分かりやすかった。

35.ordinalよりもインスタンスフィールドの値を使うべし

  • そもそもordinalメソッドはEnumSetやEnumMap用に使われるものであって、大半のプログラマは使わないものである。
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1