Learning
Ctrlk
  • Software Engineering Golden Treasury
  • Trail Map
  • Caching
  • Career
  • Computer Science
  • devops
  • General Paradigms
  • Other
  • Hardware
  • Integration
  • Languages
    • C
    • Choosing A Language
    • cobol
    • Composite Data Types
    • creating
    • Date time
    • Numbers
    • Pass by value vs Pass by reference
    • Primitive Data Types
    • REST anti-patterns
    • Rust
    • Scripting
    • Static typing
    • string
    • Task Oriented Language
    • assembly
    • Getting started
    • cpp
    • Java
      • Code style
      • Garbage Collection
      • Intellij Debugging
      • Artifacts, Jars
      • Java internals
      • Java resources
      • Java versions
      • JShell
      • Libraries
      • opinionated-guide
      • Starting java
      • Java Tools
      • Why use java
      • Advanced Java
      • Basics of java
      • Effective Java notes
        • Creating and Destroying Objects
        • Methods Common to All Objects
        • best-practice-api
        • Classes and Interfaces
        • Enums and Annotations
        • Generics
      • framework
      • Intermediate level java
    • kotlin
    • Nodejs
  • Management & Workflow
  • Networks
  • Operating Systems
  • Other Topics
  • persistance
  • Security
  • Testing, Maintainablity & Debugging
  • Version Control - Git
  • ai
Powered by GitBook
On this page
  • Use enums instead of int constants
  • Use instance fields instead of ordinals
  • Use EnumSet instead of bit fields
  • Use EnumMap instead of ordinal indexing
  • Emulate extensible enums with interfaces
  • Prefer annotations to naming patterns
  • Consistently use the Override annotation
  • Use marker interfaces to define types

Was this helpful?

  1. Languages
  2. Java
  3. Effective Java notes

Enums and Annotations

  • Enums and Annotations

    • Use enums instead of int constants

    • Use instance fields instead of ordinals

    • Use EnumSet instead of bit fields

    • Use EnumMap instead of ordinal indexing

    • Emulate extensible enums with interfaces

    • Prefer annotations to naming patterns

    • Consistently use the Override annotation

    • Use marker interfaces to define types

Use enums instead of int constants

Use instance fields instead of ordinals

Use EnumSet instead of bit fields

Use EnumMap instead of ordinal indexing

Emulate extensible enums with interfaces

Prefer annotations to naming patterns

Consistently use the Override annotation

Use marker interfaces to define types

PreviousClasses and InterfacesNextGenerics

Last updated 2 years ago

Was this helpful?