Stream examples Part 2 - Reducers

Next to collectors, Streams offer reducers as well. You can consider it as building a result, starting from a partial solution and building on top of that. It is actually comparable to how the result is built up when using recursion. As an example, let’s take the sum of all integers starting from 1 up until n. The trivial solution is 0 for the ‘empty case’, this is the value before you start looping....

April 1, 2019 · 2 min

Stream examples Part 1 - Collectors

Streams are quite fun - in short: it’s a different approach to writing loops. Suppose you have a List of Strings and you want to filter out the String starting with an ’s' and put them in a new List. List<String> sStrings = new ArrayList<>(); for(int i = 0; i < strings.size(); i++){ if(strings.get(i).startsWith('s')){ //do something with strings starting with s sStrings.add(strings.get(i)); } } Although still readable, there is a lot of redundant code: the for loop itself with the counter and condition, the if statement....

March 31, 2019 · 2 min

Version endpoint in Spring Boot

When generating your Spring Boot project using Spring Initializr, you already have the spring-boot-maven-plugin plugin in your Maven pom.xmlfile. Generating build info is done by adding the build-info goal. This results in a /META-INF/build-info.properties file in your resulting package. By default this contains group id, artifact, buildtime and version of the project. Off course you can add additional properties in the additionalProperties element. Just like you define properties in any Maven section....

February 5, 2019 · 2 min

Font Awesome with JHipster

Font Awesome offers vector icons and social logos. As it is one of the most popular icon sets, it is included with JHipster. Out of the box, only some icons are available for your angular front-end. And it’s a bit tricky to find out how these icons are loaded as all Angular components use the fa-icon directive, available in JHipster. In this particular use-case, I need to add the shopping basket icon....

January 21, 2019 · 1 min

I18N with JHipster

I myself am a huge fan of generators - it saves a lot of time. That’s why I love JHipster. JHipster not only uses my favourite frameworks such as Spring Boot and Angular, but it provides you with useful features out-of-the-box. One of the questions of the wizard guiding you through the generation of your application, is which languages you want to support. For every selected language, all possible labels are generated....

January 15, 2019 · 3 min