Quantcast
Channel: Pure-Essence.Net » java
Browsing all 10 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Java: static declaration of collection

I don’t know if this is a new feature in Java 5 that I did not know before or I just did not know this is possible in Java. But I learned today that you can do static declaration of collection types as...

View Article


Image may be NSFW.
Clik here to view.

Java List/Array syntax

Something I always forget, a shortcut array syntax for Java: List<T> listOfAnything = Arrays.asList(t1, t2);

View Article


Image may be NSFW.
Clik here to view.

Java: BETTER way to traverse a map

While reviewing the findbugs report (WMI_WRONG_MAP_ITERATOR) for a new project at work, I learned a better way to traverse a map in Java. In fact, since the first day I started coding in Java, I never...

View Article

Image may be NSFW.
Clik here to view.

Setting private property without setter in Java

Not really a new trick but I had to look for the syntax today to use reflection to set a private property on an object to use it in a junit test. Class clazz = someFooObject.getClass(); Field f =...

View Article

Image may be NSFW.
Clik here to view.

Java instaniate an abstract class… sort of…

At work I had to create some test data for a junit test. The function I’m testing expects a super abstract class to be passed in and I need to test the same function for bunch of child classes. I wish...

View Article


Image may be NSFW.
Clik here to view.

itext page number (page x of y)

I was looking for a complete example of how to dynamically generate the page numbers when you create the pdf using iText and I couldn’t find one. This is based on the example in the iText in Action...

View Article

Image may be NSFW.
Clik here to view.

Dynamically invoke methods using spring config

A business rule at work requires some flexible configurations. I attempted to fulfill the need by create different spring batch steps/tasklets to execute each requirement based on a property value. For...

View Article

Image may be NSFW.
Clik here to view.

Grails: I will not use you

After the cijug presentation on Grails, I’ve decided I will not use it. I know Grails is hot and cool but I don’t like it. It’s probably just a personal preference. Why don’t I want to use Grails It’s...

View Article


Image may be NSFW.
Clik here to view.

Java concurrency – Multiple queue monitors

At work, I’ve implemented a queue monitor batch application. Due to business rule changes, it now needs to monitor two queues. Instead of creating another batch application, I really wanted to stick...

View Article


Image may be NSFW.
Clik here to view.

Java Generics – conditionally instantiate a class

From Class to list of Enums public static <T extends Enum> List<T> getList(Class<T> clazz) { return Arrays.asList(clazz.getEnumConstants()); } So if I want to instantiate a class via...

View Article
Browsing all 10 articles
Browse latest View live