Home » Core Java » util » Page 10

util

Java ExecutorService Example – Tutorial

Java ExecutorService is an interface that extends Executor class and represents an asynchronous execution. Executor service provides us mechanisms to manage the end and detect progress of the asynchronous tasks. In this example, we are going to see some basic functionalities of ExecutorService, as well as handle the Future object, the result of asynchronous computation. 1. Runnable vs Callable The ...

Read More »

Hashmap Java Example (with video)

Java HashMap is a member of the Java Collection Framework and is a very common way to collect and retrieve data. HashMap represents a data structure that offers key-value pairs storing, based on hashing. HashMap Methods provided, allow you to add, modify and remove elements when needed. In this example, we are going to show how we can create a ...

Read More »

java.util.Properties Example

In this example we will show how to use java.util.Properties class. Properties class is a subclass of Hashtable and represents a persistent set of properties. The Properties are key/value pairs that can be saved to a stream or loaded from a stream. Each key and its corresponding value in the property list is a string. The Properties class offers you ...

Read More »

java.util.Date Example – How to use Java util date

In this example we will show how to use the Java util Date class java.util.date . Class Date represents a specific instant in time, with millisecond precision. 1. Date constructors The java.util.Date class supports two constructors: Date() This constructor initializes a Date object with the current date and time. Time is measured to the nearest millisecond. Date(long millisec) This constructor ...

Read More »

ArrayList Java Example – How to use ArrayList (with video)

In this example, we will show how to use ArrayList in Java. The class java.util.ArrayList provides resizable-array, which means that items can be added and removed from the list by using the provided arraylist methods. It implements the List interface. A major question related to arraylists is about when to use arraylists instead of arrays and vice versa. An ArrayList ...

Read More »

Extract HTML Links with Java Regular Expression example

With this example we shall show you how to extract and process HTML links with Java Regular expression. You can follow the basic techniques in this article and learn how to process many other HTML elements and thus create a very basic HTML parser that you can easily embed in your application. So the things we want to do is: ...

Read More »

Validate HTML Tag with Java Regular Expression example

In this tutorial we are going to see how to validate HTML Tag format. In general, validating HTML with regular expressions in not the optimal method. You should use an HTML parser for that matter. But when you want to validate the basic HTML format, quickly in your application, Regular Expressions will do. So the basic policy of HTML tags ...

Read More »

Validate Date with Java Regular Expression example

In this tutorial we are going to see how to validate date format with Java Regular Expressions.The basic policy about  date of the form “dd/mm/yyyy” is that: It should start with two digits from 01 – 31 or from 1 – 31. It must be followed by ‘/’. It should be followed by two digits from 01- 12 or from ...

Read More »