Some Java oddities
I was recently asked for some simple pieces of code which some unusual uses of Java. Here are some of my favourites ;)
I was recently asked for some simple pieces of code which some unusual uses of Java. Here are some of my favourites ;)
A common question is how many objects or how many Strings does a section of code create. Often the answer is not what you think nor should you really need to know. It is useful to have an idea of when an object is created but there is so many other factors which are often far more important to consider which can mean the total number for an application is not what you think. String is a not a single object
The strategy that’s used for hashing keys, can have a direct impact on the performance of a hashed collections such as a HashMap or HashSet. The built-in hashing functions are designed to be generic and work well in a wide range of use cases. Can we do better, especially if you have a good idea of the use case?
Chronicle FIX is our Low Latency FIX engine and database for Java. What makes it different is that it;
În Java 8 poți returna un Optional în loc de return null așa cum ai putea să faci în Java 7. Aceasta ar putea sau nu să fie o mare diferenţă în funcţie de frecvenţa cu care tinzi să uiţi să verifici null sau să foloseşti analiza de cod static pentru a verifica referinţele de null. Există totuși un caz care te constrânge mai mult. Acesta constă în a trata Optional ca pe un Stream cu valori 0 sau 1.