Created
December 6, 2013 05:36
-
-
Save aya-eiya/7819081 to your computer and use it in GitHub Desktop.
Groovyのちょっとしたこと「Groovyの2.2がリリースされました。その1」 ref: http://qiita.com/aya_eiya/items/f2f669b67b7368b7aad0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 2.2.x added Implicit closure coercion | |
| */ | |
| interface StringFilter{ | |
| def filter(String source); | |
| } | |
| class SemicollonRemover{ | |
| static String remove(String source,StringFilter filter){ | |
| filter.filter(source) | |
| } | |
| } | |
| /* | |
| 2.2.x added Implicit closure coercion | |
| */ | |
| interface StringFilter{ | |
| def filter(String source); | |
| } | |
| class SemicollonRemover{ | |
| static String remove(String source,StringFilter filter){ | |
| filter.filter(source) | |
| } | |
| } | |
| println "I'm Groovy $GroovySystem.version" | |
| println SemicollonRemover.remove('hello;world;') {s->s.replaceAll(';','')} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| println SemicollonRemover.remove('hello;world;') {s->s.replaceAll(';','')} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| println SemicollonRemover.remove('hello;world;' , {s->s.replaceAll(';','')} as StringFilter) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 2.2.x added Implicit closure coercion | |
| */ | |
| interface StringFilter{ | |
| def filter(String source); | |
| } | |
| class SemicollonRemover{ | |
| static String remove(String source,StringFilter filter){ | |
| filter.filter(source) | |
| } | |
| } | |
| println "I'm Groovy $GroovySystem.version" | |
| println SemicollonRemover.remove('hello;world;') {s->s.replaceAll(';','')} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| I'm Groovy 2.2.1 | |
| helloworld |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment