Explain Codes LogoExplain Codes Logo

Java

Why would one declare a Java interface method as abstract?

java
best-practices
java-8
singleton

Why would an Enum implement an Interface?

java
strategy-pattern
enum-implementation
interface-implementation

Why there is no ConcurrentHashSet against ConcurrentHashMap

java
concurrency
collections
best-practices

Why should I use Hamcrest matcher and assertThat() instead of traditional assertXXX() methods?

java
test-development
assertions
error-handling

Why should I use Deque over Stack?

java
performance
best-practices
collections

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