Java LinkedList

Posted by Hayri Cicek on September 18, 2019

Java LinkedList is a linear data structure, which means the elements are linked using pointers.
LinkedList can have duplicate and null values and maintains insertion order.
The LinkedList can be used as a List, Queue or Stack because the LinkedList class implements List and Deque interfaces.


Read More →

Java TreeSet

Posted by Hayri Cicek on September 16, 2019

TreeSet can not contain null values and are slower than HashSet.
TreeSet contains only unique values and elements are sorted in ascending order.


Read More →

Java TreeMap

Posted by Hayri Cicek on September 14, 2019

Java TreeMap implements the Java Map interface and the key/value pairs in a TreeMap will be sorted in an ascending key order. In the following example, we create a TreeMap and adding some elements to it.


import java.util.TreeMap;

public class AddingElementsTreeMap {
    public static void main(String[] args) {
        TreeMap<Integer,String> cities = new TreeMap<>();
        
        cities.put(1, "Helsingborg");
        cities.put(5, "Stockholm");
        cities.put(3, "Göteborg");
        cities.put(2, "Malmö");
        cities.put(4, "Uppsala");

        System.out.println("Cities : "   cities);
    }
}



Read More →

Java HashMap

Posted by Hayri Cicek on September 12, 2019

Java HashMap implements Map interface and is used for storing items in key/value pairs, and you access a value by its key, and HashMap keys must be unique.
HashMap can have null value and null key.


Read More →

Java HashSet

Posted by Hayri Cicek on September 11, 2019

Java HashSet is a collection that contains unique elements and implements the Set interface.
The following example shows how to create a HashSet and add new elements using the add() method.


import java.util.HashSet;

public class HashSetAddElementsExample {
    public static void main(String[] args) {
        HashSet<String> cities = new HashSet<>();

        cities.add("Helsingborg");
        cities.add("Malmö");
        cities.add("Stockholm");
        cities.add("Göteborg");
        cities.add("Helsingborg");
        
        System.out.println("Cities : "   cities);
    }
}



Read More →

Java ArrayList

Posted by Hayri Cicek on September 10, 2019

Java ArrayList are dynamic arrays that can grow as needed not like standard Java arrays which are fixed length. The following statement will create an ArrayList.


ArrayList<Integer> numbers = new ArrayList<>();


Read More →

Introduction to Java: Date

Posted by Hayri Cicek on September 09, 2019

To get the current date is really simple in Java, you just instantiate the Date object from the java.util package.


Date currentDate = new Date();


Read More →

Introduction to Java: Methods

Posted by Hayri Cicek on June 14, 2019

Methods in Java is a block of statements that must be in a class and can be executed by calling it from other places.


Read More →

Introduction to Java: Arrays

Posted by Hayri Cicek on June 12, 2019

Arrays are a collection of elements having same type. To declare an array, we define the variable type with square brackets.


Read More →

Introduction to Java: While Loop

Posted by Hayri Cicek on June 11, 2019

While-loop executes a block of code as long as a specified condition is true.


Read More →

Introduction to Java: For Loop

Posted by Hayri Cicek on June 10, 2019

In this tutorial, you will learn how to create a for loop. A loop is used to repeat a specific block of code until the condition is met.


Read More →

Introduction to Java: Switch Statements

Posted by Hayri Cicek on June 09, 2019

Switch Statement is used when we want to check equality of a variable against number of values.


Read More →

Introduction to Java: If Statements

Posted by Hayri Cicek on June 08, 2019

If statement is the most basic way of test a condition. With the if statement you test if a condition is true or false.


Read More →

Introduction to Java: First Java Program

Posted by Hayri Cicek on June 07, 2019

In this tutorial we will learn how to write, compile and run our first Java program.
You need to have Java installed on your system, go to https://openjdk.java.net/ and download JDK for the operating system you use.


Read More →

MicroProfile JWT with Keycloak

Posted by Hayri Cicek on April 23, 2019

In this tutorial, we will learn how to secure our services using MicroProfile JWT and Keycloak. Go to https://www.keycloak.org/downloads.html and download latest Standalone server distribution. Unzip the zip file and open a new terminal window and navigate to the keycloak folder.


Read More →

MicroProfile Rest Client

Posted by Hayri Cicek on November 05, 2018

MicroProfile Rest Client is used to invoke RESTful services over HTTP and in this tutorial we will learn how to use it.

Tools You Will Need
Maven 3.3+
Your favorite IDE. I'm using NetBeans
JDK 1.8+

Thorntail Project Generator
Go to https://thorntail.io/generator/ and follow the steps below to generate a new project.


Read More →

Deploy MicroProfile application on Heroku

Posted by Hayri Cicek on October 09, 2018

In this tutorial we will learn how to deploy our MicroProfile application on Heroku and we will use Payara Micro as our application server.
Heroku is a cloud platform as a service (PaaS) supporting several programming languages and I've been using it for several years without any problems.

Tools You Will Need
Ma...


Read More →

MicroProfile Config using TomEE

Posted by Hayri Cicek on September 09, 2018

TomEE version 7.1.0 now supports MicroProfile and in this quick tutorial I will show you how to get started with MicroProfile Config using TomEE application server.

Tools You Will Need
Maven 3.3+
Your favorite IDE
JDK 1.8+
Git

Clone the TomEE Starter Project from Github

$ ...


Read More →

Integration Tests with Arquillian using TomEE

Posted by Hayri Cicek on September 03, 2018

In this tutorial we will learn how to integrate tests with Arquillian using TomEE Application Server.

Tools You Will Need
Maven 3.3+
Your favorite IDE
JDK 1.8+
Git

Clone the TomEE Starter Project from Github

$ git clone https://github.com/cicekhayri/tomee-javaee-crud-rest-starter-project.git
Now it's time to add some depende...


Read More →

Getting Started With MVC 1.0 (JSR 371)

Posted by Hayri Cicek on August 20, 2018

In this tutorial we will create a simple web application using MVC 1.0 (JSR 371), Thymeleaf, H2 database, JPA and Thorntail (Wildfly Swarm).
MVC 1.0 is based on JAX-RS and integrates with existing Java EE technologies like CDI and Bean Validation.


Read More →

Getting Started with MicroProfile Metrics and Prometheus

Posted by Hayri Cicek on August 16, 2018

In this article we will learn how to use MicroProfile Metrics and Prometheus to collect metrics from monitored targets.

Tools You Will Need
Maven 3.3+
Your favorite IDE
JDK 1.8

WildFly Swarm Project Generator
Go to http://wildfly-swarm.io/generator/ and follow the steps below to generate a new ...


Read More →

Documenting REST API using MicroProfile OpenAPI, Swagger UI and Payara Micro

Posted by Hayri Cicek on August 10, 2018

In this tutorial I will show you how to generate api documentation using MicroProfile OpenAPI and Payara Micro runtime.
Learn more about MicroProfile OpenAPI Specification

Tools You Will Need
Maven 3.3+
Your favorite IDE. I'm using Net...


Read More →

Getting Started With MicroProfile Config using Payara Micro

Posted by Hayri Cicek on August 08, 2018

In this tutorial we will learn how to use MicroProfile Config API using Payara Micro
MicroProfile Config API can be used to retrieve configuration information from different sources.

Tools You Will Need
Maven 3.3+
Your favorite IDE. I'm using NetBeans
...


Read More →

MicroProfile REST API with MongoDB, Hibernate OGM and Thorntail

Posted by Hayri Cicek on August 07, 2018

In this tutorial we will learn how to create REST API using MicroProfile, MongoDB, Hibernate OGM and Thorntail (wildfly-swarm)

Tools You Will Need
Maven 3.3+
Your favorite IDE. I'm using NetBeans
JDK 1.8+

Install MongoDB
To down...


Read More →

Simple CRUD REST API with Java EE

Posted by Hayri Cicek on August 02, 2018

In this tutorial we will learn how to create a simple CRUD REST API with Java EE using H2 database and TomEE application server.
H2 is an open source relational database management system written in Java. It can be embedded in Java applications or run in the client-server mode and it is easy to install and deploy.

Tools You Will Need
Maven 3.3+
Your favorite IDE. I'm usi...


Read More →

Getting Started With MicroProfile

Posted by Hayri Cicek on July 29, 2018

In this tutorial I'll show you how to get started with MicroProfile.

Tools You Will Need
Maven 3.3+
Your favorite IDE. I'm using NetBeans
JDK 1.8+

Generate Maven Project
In your terminal type the following

$ mvn archetype:generate -DgroupId=com.kodnito -DartifactId=getting-started-with-javaee 
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=fal...


Read More →

Spring Boot REST API Documentation Using Swagger 2 With Springfox

Posted by Hayri Cicek on July 28, 2018

In this tutorial we are going to learn how to document our Spring Boot REST APIs using Swagger with Springfox.

Tools You Will Need
Maven 3.3+
Your favorite IDE. I'm using NetBeans
JDK 1.8+

Creating the Project With Spring Initializer
Go to start.spring.io and follow the steps below to genera...


Read More →

Spring Boot Thymeleaf Introduction

Posted by Hayri Cicek on July 27, 2018

In this tutorial, we are going to create a simple Spring Boot web application with Thymeleaf template engine and H2 database.

Tools You Will Need
Maven 3.3+
Your favorite IDE. I'm using NetBeans
JDK 1.8+

Creating the Project With Spring Initializer
Go to start.spring.io and follow the steps below to ...


Read More →

Spring Boot With H2 Database

Posted by Hayri Cicek on July 25, 2018

H2 is an open source relational database management system written in Java.
It can be embedded in Java applications or run in the client-server mode and it is easy to install and deploy.

Tools You Will Need
Maven 3.3+
Your favorite IDE. I'm using NetBeans
JDK 1.8+

Creating the Project With Spring Initializer
Go to start.spring.io and f...


Read More →

Getting started with Spring Boot

Posted by Hayri Cicek on July 23, 2018

With this tutorial I’ll show you how you can get started with Spring Boot.

Let’s get started!

The first thing to do is to navigate to start.spring.io, it is the place where you create your spring boot applications.

Group Id: com.kodnito
Artifact: Hello
Dependencies: Web
and cli...


Read More →