Core java
09 JuneJava ExecutorCompletionService
In this post, we will see about Java ExecutorCompletionService example. ExecutorCompletionService class implements CompletionService. This class returns Future object in completion order. Why you may need to use ExecutorCompletionService: Let’s understand with the help of scenario: Let’s say you have 5 tasks, you submit it to the executors and you want to perform some operation as soon […]
09 JuneHow to find length/size of Arraylist in java
In this tutorial, we will see how to find length/size of Arraylist in java. You can use ArrayList’size() method to calculate size of ArrayList. Let’s understand it with the help of Simple example. package com.arpit.java2blog; import java.util.ArrayList; import java.util.List; public class ArrayListLengthMain { public static void main(String args[]) { List<String> countryList=new ArrayList<>(); countryList.add("India"); countryList.add("China"); countryList.add("Bhutan"); […]
05 JuneJava newSingleThreadExecutor example
In this tutorial, we will learn about Executor’s newSingleThreadExecutor factory method. In the last tutorial, I have shared an introduction to ThreadPoolExecutor. If you are not aware of concepts of ThreadPoolExecutor, you should go through that first. Executor’s newSingleThreadExecutor factory method : This method returns thread pool executor which executes one task at a time.If […]
01 JuneOcean Breeze Casino Sign-Up Guide: Quick Steps and Tips
Setting up an account at an online casino is quick, but knowing exactly what to expect at each step saves time and frustration. This guide walks you through everything from prerequisites to claiming your first bonus at Ocean Breeze Casino. Prerequisites You must be at least 18 years old (or the legal gambling age in […]
29 MayJava ScheduledThreadPoolExecutor Example
There are multiple ways to schedule a task in java. We have already Java timer to schedule a task but the problem with timers task is that you can execute one task at a time.So if the current task takes longer subsequent job will be delayed. In this scenario, you can use Java ScheduledThreadPoolExecutor.This class […]
28 MayJava FutureTask example
In this tutorial, we will see about Java FutureTask example. FutureTask class has been introduced in JDK 5 with Executor Framework. FutureTask class is the concrete implementation of the Future object and provides methods for start and cancel the task.It also provides method to see if the computation is done or not. We can query […]
28 MayIntroduction to Java Programming Language
Introduction Java is a programming language and computing platform which serves as a general-purpose language for developers to create modular programs and reusable code. With its Write Once Run Anywhere principle, Java is now of the most widely used and recommended programming language for developing desktop as well as web applications in today’s digitized world. […]
28 MayJava Hello World Program
Introduction In this post, we will see how to write your first java program. This post is intended only for java beginners to acquaint them with the steps to write a simple java program. Simply put, we will write a code that outputs "Hello World!" to your console/screen. For Folks having some knowledge in other […]
28 MayConstructor in java
Constructor in java is block of code which allows you to create instance of the object. It does not have return type. It has two main points Constructor name should be same as class Constructor should not have any return type else it will be same as method. [toc] There are three types of Constructor in […]