Laurent Hinoul

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - John F. Woods

Tag: java

How to create a stream from an iterator in java 8

Hi guys! In this post I’ll show you how to convert an java iterator to a java 8 stream. The code is really simple:

Just copy paste this static method in any class you like. It’s generic so you can use this method for all types of iterators. Enjoy!

How to fix Unirest General SSLEngine problem

I tried to post data to a rest service using Unirest ( But when I tried to post to an HTTPS url, I got the following error:

To fix this, you could use the following code:

Then, you need to execute the code below before useing Unirest itself:

Hopefully this works for you too. Enjoy

How to use json with java

Is it possible to use json in combination with java? The answer is yes! You can easily parse json objects to java objects and and vice-versa. To do so, you can use Google’s framework ‘gson’: Maven dependency