Measuring compact strings memory savings
Java Specialists
by
2d ago
JEP 254 replaced the char[] in our Strings with byte[]. How much memory does this save in our Strings? In this newsletter we show how we can determine this from a heap dump file ..read more
Visit website
Contributing BigInteger.parallelMultiply() to O...
Java Specialists
by
2M ago
BigInteger has clever algorithms for multiplying large numbers. Unfortunately multiply() is single-threaded. Until now. In this newsletter I describe how the new parallelMultiply() method works and also how we can all contribute to the OpenJDK ..read more
Visit website
Null Keys and Values in Maps
Java Specialists
by
5M ago
Some Map implementations allow null keys and values. This leads to funky behaviour when calling putIfAbsent() and the compute functions. In this newsletter we look a bit more closely at the issues at hand when allowing nulls in maps ..read more
Visit website
Break in Switch With Pattern Matching
Java Specialists
by
10M ago
The enhanced switch is cool. Pattern Matching for switch is super cool (they even timed the JEP number to be exactly 420 - or was that fate?). But what happens when we use "break" inside the case statement? Let's find out ..read more
Visit website
Synchronizing on Value-Based Classes
Java Specialists
by
10M ago
Locking on Integer objects has always been a bad idea. And we now have a way to find such bad code with a runtime switch DiagnoseSyncOnValueBasedClasses ..read more
Visit website
String.format() 3x faster in Java 17
Java Specialists
by
1y ago
One of the most convenient ways of constructing complex Strings is with String.format(). It used to be excessively slow, but in Java 17 is about 3x faster. In this newsletter we discover what the difference is and where it will help you. Also when you should use format() instead of the plain Stri ..read more
Visit website
Threading Questions in Job Interviews Part 2
Java Specialists
by
1y ago
In our previous newsletter, we showed 14 typical questions that interviewers ask to find out if we know threading. Here are our model answers. Use them with caution. The interviewer is probably reading my newsletter ..read more
Visit website
Puzzle: Is a Programmer a Person?
Java Specialists
by
1y ago
In today's puzzle, we want to sort a list of persons. It works in some versions of Java, but not in others. You need to figure out why ..read more
Visit website
Performance Impact of Design Patterns
Java Specialists
by
1y ago
The Java Development Kit is filled with great examples of how design patterns can be used to make the Java code easier to maintain. But what is the performance impact of all this indirection and additional object creation? In this newsletter we explore how the compiler makes well-factored Java ..read more
Visit website
Strings with Zero HashCode
Java Specialists
by
1y ago
In Java 2, the computational time complexity of String#hashCode() became linear, as it used every character to calculate the hash. Java 3 cached the hash code, so that it would not need to be recalculated every time we called hashCode(), except in the case that the hash code was zero. Java 13 fi ..read more
Visit website

Follow Java Specialists on Feedspot

Continue with Google
OR