Rails IDEs issues: change Java interpretor to Sun Java 6 JRE

Sometimes,the Rails (mostly written in Java, like RadRails, RubyMine, 3rd Rail, or Netbeans for Ruby) have some problems running with the default Ubuntu open source java interpretors. You may check the installed java version with:

java -version

Continue reading


Java Lists: Group by element property (as Ruby group_by method)

This is a very funny function, similar to group_by from Ruby.
It takes a collection and it transforms to a hash, having keys the property *groupBy*, and values the objects having that property.

A usage example:

collectionToHash(users, "name"); // returns a hash where the keys are the distinct user names, and the values are lists of users having that property.

Continue reading