runner
runner copied to clipboard
Add Groovy 4
- Name: Groovy
- Version: 4 (Potentially Version 4.0.22)
- Changelog: https://groovy-lang.org/changelogs/changelog-4.0.22.html
- Release Notes: https://groovy-lang.org/releasenotes/groovy-4.0.html
Groovy 2.5, the currently only version available, came out in 2018 while Version 4 was first released in 2022 and is currently getting new updates. As of writing this, the newest version was released in June 2024. The newer versions of Groovy 4 support Java 17, which is also the newest Java Version supported on Codewars. Due to being compatible with JDK 16+, it brings a lot of nice features from Java:
- Sealed Classes (which was a preview in JDK 16 and became a full feature in JDK17)
- Records
- Pattern matching for switch statements as Preview Feature (JDK 17+)
- ...
2 Other things that would help with a newer Groovy version, especially for writing Test Cases:
ArrayList.shuffled()to both shuffle a list and return it afterwardsRandom.nextInt(int origin, int bound). Currently, a workaround likemin + Random.nextInt(max)orrandom.nextInt(max + 1 - min) + minis required to achieve the same effect