Explain Codes LogoExplain Codes Logo

Java

Why is String.chars() a stream of ints in Java 8?

java
stream-api
performance-optimization
primitive-types

Why is Maven downloading the maven-metadata.xml every time?

java
maven-metadata
maven-settings
maven-plugins

Why is exception.printStackTrace() considered bad practice?

java
logging-best-practices
exception-handling
thread-safety

Why is Double.MIN_VALUE not negative?

java
floating-point-arithmetic
java-8
precision

Why is (a*b != 0) faster than (a != 0 && b != 0) in Java?

java
branch-prediction
performance-optimization
jvm-optimizations

Why explicitly throw a NullPointerException rather than letting it happen naturally?

java
best-practices
debugging
exception-handling

Why do Java programmers like to name a variable "clazz"?

java
conventions
best-practices
readability

Why doesn't "System.out.println" work in Android?

java
logging
android-logging
logcat

Why doesn't String switch statement support a null case?

java
null-safety
switch-statement
java-21

Why does Maven warn me about encoding?

java
encoding-warnings
maven-plugins
utf-8-encoding

Why does appending "" to a String save memory?

java
string-interning
memory-optimization
garbage-collection

Why an abstract class implementing an interface can miss the declaration/implementation of one of the interface's methods?

java
programming-to-an-interface
design-patterns
inheritance

Which is the best library for XML parsing in Java?

java
xml-parsing
java-libraries
xml-parser-comparison

Which concurrent Queue implementation should I use in Java?

java
thread-safety
concurrent-programming
queue-implementation

Where is the documentation for the `values()` method of Enum?

java
enum-methods
compiler-generated-methods
java-enum

When using Spring Security, what is the proper way to obtain current username (i.e. SecurityContext) information in a bean?

java
dependency-injection
security-context
spring-security

When to use Spring Integration vs. Camel?

java
integration-patterns
spring-ecosystem
framework-comparison

When to use @QueryParam vs @PathParam

java
api-design
rest-api
path-params

When to use generic methods and when to use wild-card?

java
type-parameters
wildcards
generics

When should we use Observer and Observable?

java
event-driven-architecture
thread-safety
memory-leaks