Skip to content

khachornchit/java-review

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Review

Core Java Review

This repository serves as a comprehensive review guide for core Java concepts, offering a structured overview of fundamental topics essential for Java development. It covers essential data types, string manipulation, conditional statements (if, else, switch), and looping constructs. Additionally, the repository delves into array usage, static keyword applications, string builder functionality, and techniques for string comparison. Core principles of collections, including Sets and Lists, are explained, followed by a detailed exploration of HashMaps and LinkedHashMaps. Object-oriented programming (OOP) principles are covered, emphasizing encapsulation, inheritance, and polymorphism. The repository concludes with a study of generics, providing a solid foundation for Java developers or those seeking a refresher on key language features.

Java8 Review

Lambda Expressions

Advantage: Lambda expressions enable concise and expressive syntax for writing anonymous functions. This promotes functional programming paradigms in Java.

Lambda Benefit

  • Enables functional programming
  • Readable and concise code
  • Easier to use APIs and libraries
  • Enables support for parallel processing

Functional Interfaces

Advantage: Functional interfaces, interfaces with a single abstract method, can be used in conjunction with lambda expressions, promoting a functional programming style.

Stream API

Advantage: Streams provide a declarative and parallel approach to processing collections, enhancing code readability and performance.

Default Methods

Advantage: Default methods allow interfaces to have method implementations, aiding in backward compatibility when adding new methods to interfaces.

Date and Time API

Advantage: While not specifically designed for microservices, Java 8's features, especially lambda expressions and the Streams API, can contribute to writing more modular and scalable code.

Method References

Advantage: Simplicity and conciseness when calling a static method.

Method References

  • Reference to a Static Method
  • Reference to an Instance Method of a Particular Object
  • Reference to an Instance Method of an Arbitrary Object of a Particular Type
  • Reference to a Constructor

Optional

  • Avoiding Null Checks with Optional
  • Chaining Optional Methods
  • Default Values with orElse
  • Throwing Exceptions with orElseThrow

Streams

Advantages of Streams:

  • Concise and Declarative Syntax: Streams provide a concise and declarative way to express complex data manipulations. The code is often more readable and expressive.
  • Parallelism: Streams can easily be parallelized, allowing for efficient parallel processing of data. This is particularly useful for modern multicore processors.
  • No Side Effects: Stream operations do not modify the underlying data source. They are designed to be non-mutating, promoting functional programming principles.
  • Pipeline of Operations: Stream operations can be chained together to form a pipeline, enabling a sequence of operations to be applied to a collection in a single statement.

Nashorn (JavaScript Engine)

About

This repository reviews Java Core and Java 8 functionality, i.e. lambdas function, functional interfaces, method references, and collections, collections improvements, and how come the benefit of using lambda enables functional programming, readable and concise code, easier-to-use APIs and libraries, enables support for parallel processing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors