Java Anti-Patterns Overview
Java Anti-Patterns Overview
Not Closing Resources Properly
Not Closing Resources Properly
Using Raw Types Instead of Generics
Using Raw Types Instead of Generics
Excessive Null Checks
Excessive Null Checks
Using Exceptions for Flow Control
Using Exceptions for Flow Control
Mutable Public Fields
Mutable Public Fields
Returning Null Instead of Empty Collections
Returning Null Instead of Empty Collections
Using == Instead of equals() for Objects
Using == Instead of equals() for Objects
==
operator compares object references, not their contents. Use equals()
to compare object values.Not Using StringBuilder for String Concatenation
Not Using StringBuilder for String Concatenation
Using Singleton Pattern Incorrectly
Using Singleton Pattern Incorrectly
Not Using Interface for Type
Not Using Interface for Type
Not Using try-catch-finally Correctly
Not Using try-catch-finally Correctly
Not Using Java 8+ Features
Not Using Java 8+ Features
Using Checked Exceptions Excessively
Using Checked Exceptions Excessively
Not Using Immutable Objects
Not Using Immutable Objects
Using System.out.println for Logging
Using System.out.println for Logging
System.out.println
for logging doesn’t provide features like log levels, formatting, and output configuration. Use a proper logging framework like SLF4J with Logback or Log4j.Not Using Dependency Injection
Not Using Dependency Injection
Not Using Java Collections Framework Correctly
Not Using Java Collections Framework Correctly
Not Using Appropriate Concurrency Utilities
Not Using Appropriate Concurrency Utilities
Not Using Java Time API (Java 8+)
Not Using Java Time API (Java 8+)