If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Wednesday, February 24, 2010

Function that checks if 2 collections intersect (xslt2.0)

XPath does offer a intersect operator but that operator checks only on 2 node sets. I needed to check if a nodeset(status as xs:string) intersected with a predefined sequence of statuses ('RFS', 'DOD', 'WIT', 'OBS').

I ended up writing some generic function:



The way I can call this function now is:

Friday, February 19, 2010

AspectJ dependencies are skipped by maven-eclipse-plugin

I just upgraded my maven-eclipse-plugin from version 2.5 to 2.7. Running mvn eclipse:eclipse looked normal but Eclipse was complaining about AspectJ classes which could not be found... I opened the classpath file and verified that indeed the aspectj jars were not included. A quick search on google resulted in following JIRA issue.

Provided solution:

Grouping objects from Java Collection

I had the need to group objects from a java collection on multiple occasions but a google search for easy ways to accomplish this was unsuccessful. For my last project i wrote some generic classes which enable me to group objects from any java collection based on a specified getter method. I also want them sorted based on the grouping key so the return type of the getter method needs to be a comparable.













So now we can get groups based on reflection with just a few lines of code: