Blog Archive

Sunday, June 25, 2017

Groovy syntax step by step with examples for my reference

Om







Comparing java syntac and groovy syntax together , both works here;


IndexOf, [],  double dot notation



subString



concat and split toList



replaceAll



string output format


Reading input from console



accessing values in list.


List in List and reading.


Add remove isEmpty of List


List reverse, sort, pop


Working with map and list and compare


map size


working with ranges



conditional operators





conditional with ternary ?


using switch and break 





while and break


for loop ( ranges, list, map)


for loop for map


Groovy class and static method


parameters to method and calling in main method


Pass by value


Passing list to method


closure notation in groovy 


recursion method.


assigning value to variable using ternary condition.



closure nation for map iternation


closure : each, find, findAll, any, every, collect






Groovy files ( reading lines, add line, remove and modify lines of the file)
create a file and remove file







directory and file properties display.




Groovy Object oriented programming basics
1. Create calls animal
2. create another class dog which extends animal
3. create objects pass parameters
( also learn this. and super() method usage )









No comments:

Post a Comment