Java streams are sequences of data elements that can be processed with operations. Streams consist of 3 parts: a source, zero or more intermediate operations, and a terminal operation.In the meanwhile there is a data in pipe, another data is waiting its turn. For instance, for a data in terminal […]
Java
One of the parent languages of object-oriented programming, at high level and with static typing, boasts the ability to abstract hardware differences to allow you to write valid code anywhere.
Java generic types
Let’s talk about the Java generic types. Most of the time, we add generics to make lists type-safe.We have pre-java 5 lists without generics that can get all known object’s types and when you get an object out of it we don’t know its type. When we use generics we […]
Tips: rest API POST content types
If we need to POST an object with validated field, we can send it from our FE (Angular, React, etc…) application with 2 main content types: JSON or “form encoded”.Pay attenction to not use the @RequestBody annotation if you want to send those datas in the second one type.The application […]
Exception handling and multi-catch
Sometimes we want to handle different types of exception the same way, to have more control and details on the type of error our program runs into. […]
Optionals in Streams for Java
Optionals are the Java’s way to make sure something comes out of streams, even in those cases where there may not be a result.The reason for their existence, their “raison d’être” is that, when a return value is defined in a method, that method must necessarily return something. Use Optionals […]