Posts Tagged: apache commons

Parallel : Groovy and Java Streams

Posted by & filed under .

This is something that every now and then I have to do: check whether either one or all elements of a collection meet a certain criteria. The standard code initially in Java involved a for loop and iterating through the collection explicitly and checking the condition at each step. Then Apache Commons came on with their […]

java code

Parallel Sorting in Java 8

Posted by & filed under , , .

I started playing with Java 8 relatively recently (booo! 🙂 ) — and going through the new features this JDK brought, I keep discovering things which I feel deserve more attention than they have been given. Sure, everyone is raving about the lambda expressions, try-with-resources and so on, but occasionally there are small additions that […]

Perf4J and Object Creation/Destroy

Posted by & filed under , , , .

If at any point in your coding life you had to measure some component performance, chances are that you came across Perf4J at some point. To quote from their own website: Perf4J is to System.currentTimeMillis() as log4j is to System.out.println() There are of course other ways to measure timings of components execution, however, I found […]

Playing Around with Buffers

Posted by & filed under , , , .

I found myself recently using the Buffer class in the Apache Commons Collections framework — and realised that the Buffer-related classes don’t get enough coverage as they probably should, since they can actually provide out-of-the-box solutions to common development problems. So I started this little exercise partly to demonstrate some of the powerful Buffer-based classes […]

maven site Problem with Hash Symbol (#)

Posted by & filed under , .

Not sure if it’s just me who’s been digging around this issue for a while, maybe it’s common knowledge to the maven community, but I found this very frustrated dealing with this and researching it on the net, so having finally found the solution to this I thought I’d post it here. If nothing else, […]

Cache Ahead using Apache Commons Pool

Posted by & filed under , .

If you have done any code that needs some sort of pooling of resources (which is some sort of caching, let’s face it), you would have no doubt come across Apache Commons Pool. (In fact the DBCP pool is used as a standard in applications which require database connection pooling.) The framework offers most of […]

Simplify Your Singletons

Posted by & filed under , .

I’ve seen recently some Java code (I’m not telling whose, you probably know who you are :p) where a singleton pattern was involved. Nothing unusual here, you would say — and you’re right, I probably found myself using Singleton and Factory and Observer in pretty much every single Java project I ever worked on. The […]

Scripting

Groovy Scripting at the Power of Commons CLI

Posted by & filed under , , .

I’ve found myself more and more scripting stuff in Groovy — partly I’m guessing it’s cause of my Java background, partly because I’m probably not such a good bash/awk/perl/sed/etc script hacker 🙂 Nevertheless, make no mistakes, Groovy is an awesome scripting tool! (I’m not going to praise its benefits in terms of building applications — […]

Dealing with Java Beans via Apache Bean Utils

Posted by & filed under , , .

Ok some of you are probably already familiar with the Apache Commons‘ BeanUtils framework, so this might not come as a surprise, but I have just discovered recently a class which I found myself in the past implementing bits of, one way or another: the BeanMap class! I swear, when dealing with loading random properties […]

Data Validation inside a List

Posted by & filed under , , .

Felt like sharing this, since there might be some other “dinosaurs” like myself (i.e. slow in their using the Apache Commons Collections) — and those guys might find this useful 🙂 Occasionally you find yourself providing components that will be used by various modules in a project, and as such you have to employ strict […]