Skip to content

Tag: java-8

How to map an OptionalLong to an Optional?

I have an instance of OptionalLong. But one of my libraries requires an Optional<Long> as a parameter. How can I convert my OptionalLong into an Optional<Long>? I was dreaming about something like this: Answer I don’t know simpler solutions but this will do what you need.

Minimum Spring version compatible with Java 11

I need to upgrade an app to Java 11 very soon, I was wondering what’s the minimum Spring version that is compatible with Java 11. I’m currently using Java 8 and Spring 4.2.7. Answer From their task tracker — SPR-16391:Compatibility with JDK 11. The compatibility of JDK 10, 11 is planned alon…

Counting items from Map having Set as value

I have a list of items as below Now I am converting this list into here complexList gives output as Now I need to count number of values for each “capacity” giving output as I tried and it outputs I must be mistaking in understanding streams or not be using right methods. Can anyone suggest an app…

logging in interface methods

I have been working on java 7 so far and recently moved to java-8, one thing which was surprising is that you can add methods in java-8 interfaces. So far so good….loved this new stuff! Now, my problem is that logging is an essential part of any development but seems lombok.extern.slf4j won’t let …