Pure-Essence.Net

Java: static declaration of collection

Posted by: pureessence on: December 17, 2008

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 below:

public static List supportedCopyPropertyTypes = new ArrayList() {
		private static final long serialVersionUID = 660145948432567403L;
		{
			add("String");
			add("BigDecimal");
			add("int");
		}
	};

Advertisement

1 Response to "Java: static declaration of collection"

always nice to find useful code samples online!

Thanks for this one.

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

My most adorable Pomeranians

Categories

Archives

SocialVibe


Follow

Get every new post delivered to your Inbox.