售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Title Page
Copyright
Introduction to JVM Languages
Credits
About the Author
About the Reviewer
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
Java Virtual Machine
JVM implementations
Why develop on JVM?
JVM adapts to market changes
Java Class Library
Ecosystem
Scenario 1 – Using a JVM application server
Scenario 2 – Using a general high-level web application framework
Scenario 3 – Using a microservice framework
Popular use cases
Web applications
Big data
IoT
JVM concepts
Virtual machine
The JIT compiler
Primitive datatypes
Classes
Reference types
References and null references
Garbage collector
Example
Backward compatibility
Build tools
Java editions
Java SE
Java EE
Example – Java Persistence API as implemented by two application servers
Java ME
Other languages on JVM
Why choose a language other than Java?
Java is a very verbose language
Java is not ideal for everything or everyone
Missing classes in Java Class Library
Mixing JVM languages in a project
Increasing build process complexity
Language runtime libraries
Writing unit tests in a different language
Summary
Developing on the Java Virtual Machine
JDK
Installing JDK
Downloading JDK
Installing JDK on Windows
Installing JDK on macOS
Installing JDK on Linux
Downloading API documentation
Exploring JDK
The directory structure
JDK commands
GUI monitoring tools
Java VisualVM
Oracle Mission Control
JConsole
JRE
Class organization with packages
What are packages?
Choosing a package name
Package name examples
Fully qualified class name
Java Class Library
Java Class Library organization
Package overview
Fundamental classes of the java.lang package
The Object class (java.lang.Object)
Important object methods
The String class (java.lang.String)
Primitive wrapper classes (Integer, Long, Short, Char, Float, Double in java.lang)
Autoboxing examples
Exceptions and errors (java.lang.Exception and java.lang.Error)
The Collections API - java.util.ArrayList and java.util.HashMap
ArrayList (java.util.ArrayList)
Commonly used methods of the ArrayList class
ArrayList usage example
HashMap (java.util.HashMap)
Commonly used methods of the HashMap class
HashMap usage example
Preparing your classes for the Collections API
About hashCode()
About equals ()
The hashing mechanism
Running JVM applications on the command line
At least one class must have a static main() method
Required directory structure for class files
Setting ClassPath for a JVM instance
Placing class files inside a JAR archive
Runnable JAR file
Running a program with the java command
Run a project consisting of separate class files
Running a project that is placed inside a runnable JAR file
Other useful parameters of the java command
-D to pass properties and values
-ea to enable assertions
A hands-on example project to run on JVM
A ClassPath example
Eclipse IDE
Downloading Eclipse IDE
Installing Eclipse IDE
Summary
Java
OOP in Java
Defining classes
Class access modifiers
Final class modifier - locking a class
Defining packages
Importing classes
Adding class members - variables and methods
Instance variables
Methods
Modifiers
Protecting class members with access modifiers
Access modifier example
Static modifier - instance variables and class variables
Final modifier - locking a class member
Overloading methods
Constructors and finalizers
Constructors
Finalizers
Extending a class
Overriding methods
Calling constructors of a parent class
Abstract classes
Interfaces
Upcasting and downcasting
Writing Java code
Operators
Conditional checks
The if...else statement
The switch...case statement
POJO
Arrays
Generics and Collections
Loops
The for loop
The normal for loop
The enhanced for loop
The while loop
The do...while loop
Exceptions
Runtime exceptions
Threads
Lambdas
Style guide
Quiz
Summary
Java Programming
Configuring Eclipse IDE
Creating a web service in Java
Creating a new Gradle project in Eclipse IDE
Exploring the generated project
Modifying the Gradle build file
Building the project
Coding the backend class
Backend class business rules
Creating a dummy implementation of the method
Creating the test case class and writing its first unit test
Implementing an input validation check
Writing the second unit test
Implementing the business logic
Creating an executable application task
Creating a web service
Running the web service
Creating Javadoc documentation
Summary
Scala
Installing Scala
Scala's Read-Eval-Print-Loop shell
Functional versus imperative programming
Scala language syntax and rules
Statically typed language
Mutable and immutable variables
Common Scala types
Any class
AnyRef class - reference classes
AnyVal class - value classes
Strings
OOP in Scala
Defining packages and subpackages
Importing members
Defining classes
Instance variables and methods
Instance variables
Instance methods
Access modifiers for class instance members
Constructors
Extending a class
Overriding methods
Overloading methods
Abstract classes
Traits
Singleton objects
Operator overloading
Case classes
Scala's standard library
Generics
Collections
Immutable list
Mutable list
Immutable map
Mutable map
XML processing
Functional programming in Scala
Iterating through collections using functions
The map, filter, and reduce design pattern
Map - transform data
Filter - filter items from a collection or array
Reduce - for performing calculations
Currying
Quiz
Summary
Scala Programming
Scala IDE for the Eclipse plugin
Installing Scala IDE for Eclipse
Switching to the Scala IDE perspective
SBT
Installing SBT
Creating an SBT-based Eclipse IDE project
Creating a new SBT project
Loading the SBTEclipse plugin
Generating a new Eclipse IDE project with SBTEclipse
Importing the generated project in Eclipse IDE
The Scala compiler (scalac)
Creating a singleton object with the main() method
Creating a singleton object that extends the App trait
Creating an Akka project
Adding an Akka dependency to the SBT build file
Updating the Scala IDE project
Akka concepts
Actors
Actor references (ActorRef)
Messages
Dispatchers
Creating our first Akka actor - QuotesHandlerActor
Creating messages
Writing a ScalaTest-based unit test
Implementing a message handler
Creating QuotePrinterActor
The main application
Summary
Clojure
Installing Clojure
Creating a start script
Creating a start script on Windows
Creating a start script on macOS and Linux
Clojure's interactive shell (REPL)
Clojure language
Syntax
Expressions
Defining variables
Defining functions
Data structures
Numeric types
Strings and characters
Collections
Lists
Vectors
Sets
Hash-maps
Iteration over arrays and loops
Conditions
Working with Java classes
Creating simple Java classes with deftype and defrecord
Managing states with agents
Agent example
Style guide
Quiz
Summary
Clojure Programming
The Counterclockwise plugin for Eclipse IDE
Installing the Counterclockwise plugin
Switching to the Java perspective
Leiningen's build tool
Installing Leiningen
Creating executable programs in Clojure
Compiling to class files without Leiningen
Compiling projects with Leiningen
Creating a new Counterclockwise project
Clojure REPL in Eclipse IDE
Updating the project's Clojure version
Adding a dependency
Exploring monads by applying test-driven development
The Luminus web framework
Creating a Luminus project
Importing the project in Counterclockwise
Exploring the Luminus project
Adding a page to the web application
Summary
Kotlin
Installing Kotlin
Launch scripts
Kotlin's REPL interactive shell
Kotlin language fundamentals
Defining local variables
Defining a function
Kotlin's types
Kotlin basic types
Strings
Null safety handling
Option 1 - Adding a conditional check
Option 2 - Using the safe call operator ?.
Option 3 - Using the Elvis operator ?:
Option 4 - Using the !! operator
Conversions
Collections and generics
Loops
OOP in Kotlin
Defining packages
Importing members
Defining classes and constructors
Adding members to classes
Adding functions
The main entry function
Adding properties
Inheritance
Interfaces
Visibility modifiers
Singleton and companion objects
Data classes
Lambdas and inline functions
Procedural programming in Kotlin
Style guide
Quiz
Summary
Kotlin Programming
Kotlin for the Eclipse IDE plugin
Installing the Kotlin plugin for the Eclipse IDE
Switching to Kotlin perspective
Apache Maven
Installing Apache Maven
Downloading a preconfigured Kotlin starter kit
Importing the project in the Eclipse IDE
Exploring the pom.xml build file
Updating the build file in Eclipse
Creating a JavaFX desktop GUI application
Preparing the project
Creating a runnable application
Writing an extension function
Layout panes
Implementing a BorderPane-based layout
Implementing animation
Debugging the program
Summary
Groovy
Installing Groovy
GroovyConsole and GroovyShell
GroovyConsole
GroovyShell
Groovy Language
Object-oriented programming in Groovy
Groovy is fully object oriented
Access modifiers
Adding properties to a class
Optional types
Automatically creating a fully featured POJO
Creating immutable classes
Groovy Development Kit (GDK)
Groovy Strings (GStrings)
Collections
Lists
Maps
Dynamic and static programming
Meta programming
Static programming in Groovy
Quiz
Summary
Groovy Programming
Installing the Groovy Eclipse plugin
Switching to Java perspective
Apache Ivy and IvyDE
Installing Apache IvyDE plugin for Eclipse IDE
Creating and configuring the project
Creating a new Groovy Eclipse project
Creating an ivy.xml file for Ivy
Java Database Connectivity (JDBC)
H2 database
Creating an in-memory database
Generating XML using MarkupBuilder
Generating XML based on SQL
The Vert.x microservice platform
Adding Vert.x dependency to Ivy
Creating the web service
Summary
Other JVM languages
Oracle Nashorn
Embedding Nashorn in JVM-based projects
Running Nashorn
Jython (Python)
Differences between CPython and Jython
Running Jython
JRuby (Ruby)
Ruby on Rails and JRuby
Running JRuby
Frege (Haskell)
Calling Java code from Frege
Running Frege
Ceylon
Ceylon's module system
Running Ceylon
Summary
Quiz Answers
Chapter 3: Java
Chapter 5: Scala
Chapter 7: Clojure
Chapter 9: Kotlin
Chapter 11: Groovy
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜