I love functional programming and I'm exciting not only about Lambda , but also about the stream API and the new functional interfaces that comes with Java 8, which was released recently . In the next lines I'll show some codes I took from some Java projects in github and rewrote it using Java 8. Notice obviously I had to mock some classes just to focus on the code rewrite. If you find a better way to do this, please let me know! Code on Github 1) Concatenating a List into a String Original public static String matrixparamtest(PathSegment id){ StringBuffer sb = new StringBuffer(); sb.append("matrix="); sb.append("/" + id.getPath()); Map matrix = id.getMatrixParameters(); Set keys = matrix.keySet(); for (Object key : keys) { sb.append(";" + key.toString() + "=" + matrix.get(key.toString())); } return sb...
Blog about programming and client applications. Target Programming languages are JavaFX, Visage, HTML 5+ Javascript or even command line apps :-D