Tuesday, 8 January 2013

Java collections for primitive types

Java collections that save memory, when elements are primitive types:
http://trove.starlight-systems.com/overview

Ease of creating immutable collection woth Guava

In case of need od creating immutable collections in java, that are nice created, safe and efficient look for guava implementations
Read examples here: http://code.google.com/p/guava-libraries/wiki/ImmutableCollectionsExplained

Wednesday, 26 December 2012

Site with calendar of professional events - lanyrd.com

If you are looking for a conference about development (but not only) look at lanyrd.com. You can there search for events by category or by location. With a host of events around the world, Lanyrd allows you to add events, discover new and exciting conferences and track your friends to see what events they are attending.
Try yourself: http://lanyrd.com/

Tuesday, 27 November 2012

RateLimiter - limit amount of actions per seconds

Next useful utility from Guava library

A rate limiter. Conceptually, a rate limiter distributes permits at a configurable rate. Each acquire() blocks if necessary until a permit is available, and then takes it. Once acquired, permits need not be released.

Rate limiters are often used to restrict the rate at which some physical or logical resource is accessed. This is in contrast to Semaphore which restricts the number of concurrent accesses instead of the rate.

You can read more in guava javadoc:
http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/util/concurrent/RateLimiter.html

Saturday, 17 November 2012

Java Random thread save

Examples:
ThreadLocalRandom.current().nextInt()
ThreadLocalRandom.current().nextDouble()
...