Posts

Showing posts from June, 2016

Spring data Mongo - Search inside array

Java 8 - Avoid null pointer exception on object calls

Optional.ofNullable().orElse(new ())).toString();

for example:

Java 8 - Avoid null pointer exception while calling a null list, set or array of objects

StringBuilder sb = new StringBuilder();
ofNullable(category).orElse(new LinkedList<>()).forEach(a->sb.append(a.toString()));

Spring data mongodb - remove element from array

Remove an element from inside an array.
Solution:

Spring - Asynchronous longpooling rest controller via "callable"

Implementation of an controller with asyncronous processing. This is a good solution for whenever a long pooling is needed.




Notes:
Though the controller seams to return imidiatelly the caller connection will still remain opened untl the results are returned. That is, this solution is not an answer to an "fire-and-forget" controller