import java.util.ArrayList class Loop2 { def array = new ArrayList() def pos = 0 void push(obj){ array[pos] = obj …
groovy 源代码
Groovy是一种基于JVM(Java虚拟机)的敏捷开发语言,它结合了Python、Ruby和Smalltalk的许多强大的特性,Groovy代码能够与Java代码很好地结合,也能用于扩展现有代码。由于其运行在JVM上的特性,Groovy也可以使用其他非Java语言编写的库。
x = ['James', 'Bob', 'Brian'] x.each { println("hello " + it) }
/** * * Test that ensures that: * * it is possible to write a builder in Groovy * it is possible to call normal me…
package groovy.bugs; import org.codehaus.groovy.dummy.ClassWithStaticMethod /** * Test case to check if imports can use fully q…
package groovy.bugs // The order of the classes is crucial, the first must be the GroovyTestCase. Its name doesn't // matter i…
package groovy.bugs class Groovy872 extends GroovyTestCase { void testScript ( ) { assertScript ( """ def cal = new Gregori…
package gls.ch03.s02 /** * GLS 3.2: The longest possible translation is used at each step, even if the * result does not u…
package gls.ch03.s02 /** Checks Lexical Translation steps as defined in $3.2 of GLS * @author Jeremy Rayner */ class Lexic…
package gls.ch03.s01; /** * Except for comments, identifiers and the contents of ... string * literals, all input elements a…
package gls.ch03.s01; /** * Except for comments, identifiers and the contents of ... string * literals, all input elements a…