Skip to content

Tag: java-9

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 recom…

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 …

JAXB not available on Tomcat 9 and Java 9/10

TLDR: On Java 9/10, a web app in Tomcat has no access to JAXB even though its reference implementation is present on the class path. Edit: No, this is not a duplicate of How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9 – as you can tell by the What I tried section, I…