Minor new features of Groovy 2.0
Posted on 04 July, 2012 (10 years ago)
—
Modified on 07 July, 2012 (10 years ago)
Although I've gone at length through the key major features of Groovy 2.0 in the InfoQ article, there have been a few smaller ones which are interesting to note. And groovy guys like Tim Yates, André Steingress or Mr Hakki were quick to blog about them!
- inject method with a default initial value
- takeWhile and dropWhile methods
- withDefault, withEager methods
- matchesPartially method for matchers (to see if a string might match a pattern given more input)
- @NotYetImplemented transformation for test cases
- an iterable collectEntries variant
- first and last working with iterables as well
- collate method (although it's also in 1.8.6 actually) (see coverage by Tim and Mr Hakki)
- calendar ranges (useful for iterating over days of a certain period)
Those are some smaller features compared to the big highlights of Groovy 2.0, but they are definitely useful and make you more productive every day!