enum HockeyAppTeam { Main('ios', 129239), Collaboration('test', 22), Matchmaking('test', 22), Messaging('test', 22) private final String rocketChatChannel private final int id HockeyAppTeam(String rocketChatChannel, int id) { this.rocketChatChannel = rocketChatChannel this.id = id } String getChannel() { rocketChatChannel } int getId() { id } public String toString() { return name() + " = " + rocketChatChannel + " " + id } } print HockeyAppTeam.values()
def variables = [ variableName: [version: '1', envVariable:'12'] ] def secretspublic = [] // init secrets println(secretspublic) variables.each{ key, value -> secretspublic.add([ secretType: 'Secret', name: key, version: value['version'], envVariable: value['envVariable'] ]) } println(secretspublic)
/* Hello World in Groovy */ class Test { def sayHello(String msg) { println msg } } def test = new Test() test.sayHello("hello")
/* Hello World in Groovy */ println("Hello world")
import groovy.json.JsonBuilder import groovy.json.JsonSlurper def json = """{"quote":{"status":"Quoting"}}""" def slurped = new JsonSlurper().parseText(json) def builder = new JsonBuilder(slurped) builder.content.quote.status = 'Enrollment' print(builder.toPrettyString())
/* Hello World in Groovy */ println("Hello world") List<String> row1 = Arrays.asList("00", "01", "02"); List<String> row2 = Arrays.asList("10", "11", "12"); List<String> row3 = Arrays.asList("20", "21", "22"); List<String> row4 = Arrays.asList("30", "31", "32"); List<List> originalList = Arrays.asList(row1, row2, row3,row4); List<List> columnList = new ArrayList<List>(originalList.size()); for(int i=0; i < originalList.size() ; i++){ List<List> originalRow = originalList[i]; for(int j=0; j < originalRow.size(); j++){ System.out.println(originalRow.get(j)); } }
foo = 42 println '$foo' println "$foo"
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more