
- Groovy Tutorial
- Groovy - Home
- Groovy - Overview
- Groovy - Environment
- Groovy - Basic Syntax
- Groovy - Data Types
- Groovy - Variables
- Groovy - Optionals
- Groovy - Numbers
- Groovy - Strings
- Groovy - Ranges
- Groovy - Lists
- Groovy - Maps
- Groovy - Dates & Times
Groovy Operators
- Groovy - Operators
- Groovy - Arithmetic Operators
- Groovy - Assignment Operators
- Groovy - Relational Operators
- Groovy - Logical Operators
- Groovy - Bitwise Operators
- Groovy - Spaceship Operator
- Groovy - in Operator
- Groovy - Elvis Operator
- Groovy - Safe Navigation Operator
- Groovy Operator Precedence & Associativity
Control Statements
- Groovy - Decision Making
- Groovy - If Else Statement
- Groovy - Switch Statement
- Groovy - Loops
- Groovy - For Loop
- Groovy - For-in Loop
- Groovy - While Loop
- Groovy - Do While Loop
- Groovy - Break Statement
- Groovy - Continue Statement
Groovy File Handling
- Groovy - File I/O
- Java - Create a File
- Java - Write to File
- Java - Append to File
- Java - Read Files
- Java - Delete Files
- Java - File Properties
- Java - File Existence and Type
- Java - File Size
- Java - File Permissions
- Java - Directories
- Java - Listing Directories
- Java - Filtering Files/Directories
- Java - Deleting Directories
- Java - Renaming Files/Directories
Groovy Error & Exceptions
- Groovy - Exception Handling
- Groovy - try-catch Block
- Groovy - try-with-resources
- Groovy - Multi-catch Block
- Groovy - Nested try Block
- Groovy - Finally Block
- Groovy - throw Exception
- Groovy - Exception Propagation
- Groovy - Built-in Exceptions
- Groovy - Custom Exception
Groovy Multithreading
- groovy - Multithreading
- groovy - Thread Life Cycle
- groovy - Creating a Thread
- groovy - Starting a Thread
- groovy - Joining Threads
- groovy - Naming Thread
- groovy - Thread Scheduler
- groovy - Thread Pools
- groovy - Main Thread
- groovy - Thread Priority
- groovy - Daemon Threads
- groovy - Shutdown Hook
Groovy Synchronization
- groovy - Synchronization
- groovy - Block Synchronization
- groovy - Static Synchronization
- groovy - Inter-thread Communication
- groovy - Thread Deadlock
- groovy - Interrupting a Thread
- groovy - Thread Control
- groovy - Reentrant Monitor
- Groovy - Methods
- Groovy - Methods
- Groovy - Optional parenthesis
- Groovy - Named Arguments
- Groovy - Closures as Arguments
- Groovy - Method Overloading
- Groovy - Method Scope and Visibility
- Groovy - isCase Method
- Groovy - Implicit Return
- Groovy - Variable Arguments
- Groovy - Regular Expressions
- Groovy - Regular Expressions
- Groovy - Defining Regular Expressions
- Groovy - Matcher Object
- Groovy - Regex Tasks
- Groovy - XML
- Groovy - XML
- Groovy - Parsing XML
- Groovy - Creating XML
- Groovy - Modifying XML
- Groovy - Querying XML
- Groovy - Simplified Notation
- Groovy - Closure based Querying
- Groovy - Closure based Creation
- Groovy - JSON
- Groovy - JSON
- Groovy - Parsing JSON
- Groovy - Creating JSON using JsonOutput
- Groovy - Creating JSON using JsonBuilder
- Groovy - Modifying JSON
- Groovy - Error Handling
- Groovy - Handling JSON Arrays
- Groovy - JSON Array Operations
- Groovy - JSON Objects
- Groovy - JSON Object Operations
- Groovy - Generics
- Groovy - Generics
- Groovy - Declaring Generic Types
- Groovy - Bound Type Parameters
- Groovy - Wild Cards
- Groovy - Miscellaneous
- Groovy - Object Oriented
- Groovy - Closures
- Groovy - Annotations
- Groovy - JMX
- Groovy - DSLS
- Groovy - Database
- Groovy - Builders
- Groovy - Command Line
- Groovy - Unit Testing
- Groovy - Template Engines
- Groovy - Meta Object Programming
- Groovy Useful Resources
- Groovy - Quick Guide
- Groovy - Useful Resources
- Groovy - Discussion
Groovy - Overview
Groovy is an object oriented language which is based on Java platform. Groovy 1.0 was released in January 2, 2007 with Groovy 5.0.0 as the current major release. Groovy is distributed via the Apache License v 2.0.
What is Groovy
Groovy is a multi-faceted Java like language with added features. Groovy supports object oriented programming along with functional programming. Groovy exhibits both static as well as dynamic nature. Groovy provides strong envionment to create Domain Specific Languages. Groovy is fully interoperaable with Java and provide language extensions using in-language macros, AST transformations and meta programming capabilities.
JVM Based Language − Groovy compiles the code to java byte code and runs on JVM. Thus porting to Groovy is very easy as it uses the existing vast ecosystem of Java and its libraries.
Dynamic & Optional Typing − Where Java is strictly typed language, Groovy is a dynamically typed language by default which means we are not bound to declare variable types. Although static typing can be done to improve performance and utilize complie time checks.
-
Object Oriented & Scripting − Groovy is an object oriented language as well as a scripting language allowing to create full fledge application as well as quick scripts.
Syntactic Sugar − Groovy is an enhancement to Java providing more concise syntax and features streamlining programming practices.
Key Characteristics of Groovy
Conciseness − Groovy code is more concise and readable and reduces boilerplate code of java.
Closures − Groovy supports first class functions which can be passed as parameters to a function enabling functional programming language.
Metaprogramming − Groovy allows to modify class and objects at runtime using techniques like ExpandoMetaClass and categories.
DSL Support − Groovy's flexible syntax and support for Metaprogramming makes it an excellent choice for Domain Specific Language, DSL.
Native XML/JSON Processing − Groovy has inbuilt support for XML and JSON parsing and generation which is very useful in webservices interaction and data manipulations.
Java Interoperability − Groovy is bidirectionally compatible with Java. We can use Java libraries, java code, interfaces. Java code can call groovy code as well.
Safety Operators − Groovy provides elvis operator, ?: safe navigation operator, ?. to handle null values gracefully avoiding null pointer exceptions.
Simplified I/O − Groovy provides easy API to read/write files.
List and Map − Groovy provides a concise syntax to create lists and maps.
Operator Overloading − Groovy provides standard operators to be redefined for custom classes.
Advantages of Groovy
Increased Productivity − Groovy provides quicker developer with less code to write.
Reduced Boilerplate − Groovy reduces a lot of boilerplate code, simplifies patterns for data structures, I/O and concurrent programming.
Excellent Scripting Support − Groovy has excellent support for gradle scripts for testing, automating system administration tasks, rapid prototyping and lots more.
Easy Learning Curve − If you know java, learning Groovy is quite easy.
Community Support − Groovy has its own active community along with vast java communities.
Official Reference
The official website for Groovy is http://www.groovy-lang.org/
