Skip to content

Tag: java-9

Java9 modules : How to execute Provider based on some priority of execution?

I am using java 9 modules to implement provider , i have multiple providers for service interface. I want to provide some priority for providers for their execution insted of using findFirst(); I have service-interface modules as below , ServiceInterface.Java I have provider-module which has two implementation for service interface , Now , i have consumer-module

Stream groupBy to nested maps with casting

Need to calculate total number by gender from below structure of nested Maps. But as data stored as Object need to cast it at every iteration. After grouping not able to cast last leaf Map to calculate and filter date object. Applied below stream, Answer It is a rather unusual way to store data. I would recommend you to implement

Functional style java.util.regex match/group extraction

Using java.util.regex to extract substrings I find myself implementing the same code pattern working around calls to : Is there a functional extension or popular library (guava / apache commons) that avoids the ugly unnecessary and error-prone local variable, like: and also a stream of match results like: It seems the only functional addition in Java8 was .splitAsStream() but that

Java 9 migration issue – package com.mymodule is declared in unnamed module , module ‘newmodule’ does not read it

I have created a multimodule project with the following structure Now i want to use which is a non modularized code in a modularized module newmodule. i have declared following in newmodule Project is compiling fine, but Intellij is showing module not found and package com.mymodule is declared in unnamed module , module ‘newmodule’ does not read it. How