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 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 Health Check

Posted by Hayri Cicek on March 03, 2019

Health checks are used to determine if the service is running, shutdown, lack of disk space or maybe issues with the database connection. In this tutorial, we will use Eclipse MicroProfile Starter to generate a new project.

Go to https://start.microprofile.io/ and follow the steps below to generate a new project.


Read More →

Building an API Backend with MicroProfile (ebook)

Posted by Hayri Cicek on February 24, 2019

Few weeks ago, I started to work on an Ebook called Building an API Backend with MicroProfile, you will learn how to create a simple RESTful API backend with MicroProfile.
The project is open source and hosted on GitHub and everybody can contribute to the project or download the ebook and start coding.


Read More →

Eclipse MicroProfile Starter

Posted by Hayri Cicek on February 19, 2019

The new Eclipse MicroProfile Starter is live and it's really easy to generate a new project.
Go to https://start.microprofile.io/ and follow the steps below to generate a new project.


Read More →

Interview With Phillip Krüger

Posted by Hayri Cicek on December 30, 2018

What is Apiee and Extensions for MicroProfile? What's so special about MicroProfile and why should we use it? Is the framework de-facto standard because it is popular? This and much more, in our interview below with Phillip Krüger!

Hi Phillip, please tell us a bit about yourself?

Hey, I’m Phillip. I’m a Systems Architect living in Centurion, South Africa. I am a fan of technology, coffee and programming. I ...


Read More →

Interview With Cesar Hernandez

Posted by Hayri Cicek on December 20, 2018

What is MicroProfile? How can we start to contribute to Open Source? This and much more, in our interview below with Cesar Hernandez!

Hi Cesar, please tell us a bit about yourself?

I'm a senior software engineer for Tomitribe, Java Champion, part of the Guatemala Java User Group and board member of JEspañol virtual Latin America JUG. I like to teach and love to learn technology in bo...


Read More →

MicroProfile and Kotlin

Posted by Hayri Cicek on November 18, 2018

Kotlin is an object oriented programming language created by JetBrains which runs on top of the JVM and can also be compiled to JavaScript or native code using LLVM.
In this tutorial we will use Kotlin language to create a simple MicroProfile REST api.

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

Clone ...


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 →