OPI Blog
Learn from experts in their fields

Browsing Tags: generics

Jun 5, 2014
Inline initialization of Java Maps
Inline initialization of maps in Java has been a sign of weakness in the Java language. This approach has given me the most concise way to initialize maps, while meeting all of my goals. Goals: ...
Creating a Hierarchical Test Data Builder using Generics
At my current client, we had a situation where we needed to write JUnit tests for REST services which used a complex object hierarchy. Creating these objects manually proved to be very tedious, so having ...
Jun 23, 2009
A Generic Way To Create a Collection
How many times do you find yourself creating this code over and over again in tests or even production code? List<String> stringList = new ArrayList<String>(); stringList.add("some test string"); stringList.add("some other test string"); aMethodThatTakesAListOfStrings(stringList); Rather than ...