Download presentation
Presentation is loading. Please wait.
Published byAlice Jefferson Modified over 9 years ago
1
A brief introduction to 11ACM 朱旻申
2
Outline What is Groovy ? Differences between Groovy & Java About closure & Dagger Methods
3
Groovy … An agile and dynamic language for the Java Virtual Machine Builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk Provides the ability to statically type check and statically compile your code
4
An Example In Groovy : In Java :
5
Grammar vs Java No “;”, “()” & “public” No constructor, no “return” No types, everything is an object Closure
6
Grammar Java without types
7
Grammar Loop
8
Grammar Use “?” to avoid NULL pointer call
9
Closure Codes in “{}”
10
Closure in iteration
12
Dagger Methods Short, small but efficient Mostly implemented by closure
13
eachWithIndex Running results : 1 : a 2 : b 3 : c
14
any & every Running results : true false
15
grep [‘a’, ‘ab’] [‘ab’]
16
sort Running results : 7, 23, 2012
17
References http:\\groovy.codehaus.org Wikipedia 百度文库
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.