Tuesday, April 28, 2009

Left Shift Operation

Recently I tried to use the operator "<<" on a a list,

List contactGroups = ['b','c','d']
List displayContactGroupList = ['a']
displayContactGroupList << contactGroups


I was expecting that at the end of the execution, I will have

displayContactGroupList = ['a', 'b','c','d' ]


However, I was surprised to find that the value was

displayContactGroupList = ['a', ['b','c','d'] ]


Learned a new thing today, So to get the effect of what I wanted to get, I will have to use

displayContactGroupList.addAll(contactGroups)

Monday, April 13, 2009

Run grails on port other than 8080

grails -Dserver.port=9090 run-app