//source: http://royontechnology.blogspot.co.at/2010/06/creating-collection-with-single-element.html //note the different constructor args; both return immutables assert [2] == Collections.singletonMap(1, 1).collect {k,v -> return k+v } assert [3, 7] == Collections.unmodifiableMap([1:2, 3:4]).collect {k,v -> return k+v }
No comments:
Post a Comment