The Java Stream API allows to create pipelines of chained methods to produce a result. It exists since Java 8. Concretely, it's a way to write some long treatments on a collection of elements in a more readable way, for example using lambda expressions. A few things to know about Stream: A stream is an... Continue Reading →
Collections in Java: there’s more than ArrayList – Java advanced (OCP)
In a previous article I covered Array and ArrayList. Here, I'm gonna go through other data structures in Java and some of their specificities. This is a high level summary and not meant to replace the official documentation. This article is applicable for Java 11 and further. This article was mentioned in JetBrains' Java Annotated... Continue Reading →
Developing secure applications – Java advanced (OCP)
This post covers Java security related topics as presented at Oracle University Online (Java SE 11 training), as required for Java Oracle Certified Professional exam. Security threats Denial Of Service (DOS) attacks: unchecked/unrestricted resources utilization.Sensitive data leaks: lack of encryption or information reduction.Code corruption: lack of encapsulation and immutability.Code injections: lack of input value validation... Continue Reading →
Annotations – Java advanced (OCP)
Java provides built-in ready-to-use annotations as well as the possibility to create one's own annotations. Annotations allow to add metadata which expresses explicit context and/or intent to various Java structures (target) as classes, methods, attributes... Annotations do not impact the behavior of their target. They are interpreted by dev tools, the environment, or the reader.... Continue Reading →
Concurrency and Multithreading – Java advanced (OCP)
Every Java program running has at least one thread, "main", automatically created by the JVM. Each thread is represented by an object of type java.lang.Thread. Thread.currentThread(); // returns currently running thread On parallelism and concurrency Before starting, I'd like to share this definition of concurrency and parallelism I found on the Oracle blog: The confusion... Continue Reading →
JDBC : Java DataBase Connectivity – Java advanced (OCP)
JDBC is a database neutral Java API in the java.sql package that allows connectivity and operations on databases. JDBC drivers provide database specific implementations of the API (for MySql, PostgreSQL, DB2… as examples). Driver libraries are made available to the application class loader via class or module path. Connecting to the database The database driver... Continue Reading →
Modularity – Java advanced (OCP)
Possibility to organize a projects in modules appeared in Java 9. In this post, we'll have a look at differences between non-modular ("legacy") projects and modular projects in Java, see how modules are created and how modular applications are run, and highlight gotcha's for those taking a certification exam covering Java modules. A Java module... Continue Reading →
Functional programming and lambda expressions – Java advanced (OCP)
Functional Programming (FP) is a programming paradigm, as OOP is. Java can make use of both. FP relies on Functions. Functions, as methods, can represent a behavior, but unlike methods, can also be used as an object an be passed as parameter or returned from a method. Functional interface A functional interface is an interface... Continue Reading →
Nested classes – Java advanced (OCP)
A nested class is a class written inside another, in order to prevent outside classes to access it or use it (improved encapsulation) and create object models meant to be used only by one class. There are four types of nested classes, which will be described in this article. Types of nested classes in Java... Continue Reading →
Class design – OOP | Preparing for Java Oracle Associate Certification (OCA) / Java basic technical tests
This article is probably to be read together with the one on methods in Java OOP. There is a lot to say about classes, so I'm concentrating on topics which require extra attention when passing Java exams or certification and tricks they use to test your knowledge. Encapsulation Encapsulation is one of the core concepts... Continue Reading →