Overview
This gives an overview of posts you can find on this website.
Overview
These posts are becoming more and more, so how do you find what might interest you?
Here are short descriptions of the various posts.
Java
General
Give Your Java Application More Memory Without User Interaction
There is a neat trick I use for giving my applications more memory without having my users fiddle around with the Java command line or the Java Control Panel.
Read Give Java Applications More Memory to learn more.
Improve Your Debugger with Views
Sometimes you have complex objects which are hard to debug because you cannot easily see what is inside. But maybe a visual display will tell more than 1000 steps?
Enhancing the Debugger with Dedicated Views shows a possibility I’m using.
Serialization of Pseudo-Constant Values
Serialization is usually a pita, and basically I’m trying to avoid it. But in some projects this is not possible. Serialization Proxy shows a way to handle what I call pseudo-constant values.
Java Package Bridge
In modern Java with Modules this is easier, but Java Package Bridge Pattern tells how to let your packages communicate internals without exposing this externally even for Java 8 and earlier.
Java 11 vs Java 8 Performance
Some measurements of the performance of a complex application under Java 8 and Java 11 are provided in Java 11 versus Java 8 Performance.
A Trap in double
/Double
Primitive double
and boxing Double
(and float
/Float
) have different ideas of various numbers.
Especially with checks for 0.0
this can lead to subtle problems.
This is elaborated in Double Equality.
A Trap in Iterator
Default methods are quite useful, but as they are usually hidden they can also make your life complicated.
One possible trap hidden in Iterable
/Iterator
is shown in
Iterator Exports Mutability.
A Trap in String.substring()
Between Java 6 and Java 7 the implementation of String.substring()
changed,
and performance was greatly slower under special circumstances.
Changed String.substring() Behavior explains what happened and what to do.
Enums
I’m a big fan of Java Enum
s which shows by the number of posts handling them.
Enhancing Enums
Want to learn possible ways to make more of your Java Enum
s?
Then read Enhancing Enums which hopefully tells you something new.
Enhancing Enums With Behavior
Want to have Java Enum
s with individual behavior for each value?
How to Enhance Java Enums With Individual Behavior shows ways to achieve this.
Typesafe Bit Flags
Using Java Enum
s is more typesafe than integer constants. But Java does not provide
enums which can be used as bit flags similar to integer constants.
Bit Flag Enums provides a way to implement typesafe enums.
Attention: long read!
Enum values()
Rant
Enum values()
Method Should Be Avoided in Time-Critical Code
explains why and what to do.
Generics
Handling Variant Generic Types
With the following types:
java.util.function.Predicate<String> pred1;
java.util.function.Predicate<Object> pred2;
why can you write
pred1.or(pred2)
but not the inverse order (logically the same but shortcut evaluation might make this more desirable)
pred2.or(pred1) // WON'T COMPILE
Combining Predicate Types explains this and provides ways to do better.
Having a Method Parameter With More Than One Type
Under some circumstances you may want to have a method parameter which can have more than one type. Multi-typed Parameters shows how to achieve this.
Math
Matrix Decomposition
Ever wanted to decompose a general geometric matrix into simpler ones like rotations, scaling etc.?
4X4 Matrix Decomposition explains how, including 4X3, 3X3, 3X2, and 2X2 cases.
Miscellaneous
War Stories
Bad Book Rant
A rant about a book I had read which uses a lot of bad Java is found in Bad Java Example from Book.