Difference between Traditional Collections and Concurrent Collections in java

Mahesh Parahar
Updated on 17-Jun-2025 16:29:14

1K+ Views

In Java, as we know, Collections are one of the most important concepts that make Java a powerful language in itself. It's the support of collections in Java that makes it support any type of data in a convenient and efficient way, along with possible CRUD operations over them. But on the same phase, when collections get exposed to a multi-threading its performance gets somewhat degraded because somewhere collections lack the support for a multi-threading environment. To overcome this limitation, Java introduces Concurrent Collections, which not only overcome the multi-threading environment limitation but also enhance Java to perform with multiple ... Read More

Posix character classes p{Digit} Java regex

Maruthi Krishna
Updated on 17-Jun-2025 16:28:12

468 Views

In this article, we will learn about the POSIX character classes p{Digit} Java regex. First, will know about \p{Digit} and the use of \p{Digit} along with examples. What is \p{Digit}? In Java regex, the \p{Digit} is a POSIX (Portable Operating System Interface) character class in Java regular expressions that matches any decimal digit character. This class matches decimal digits from 0 to 9.  The \p{Digit} is also equivalent to other expressions in Java: "\d": Follows the same POSIX standards. "[0-9]": For ASCII digits only. How to Use \p{Digit} in Java? We can use the ... Read More

How to get the date and time in JShell in Java 9?

Alshifa Hasnain
Updated on 17-Jun-2025 16:27:12

550 Views

In this article, we will learn to get the date and time in JShell in Java 9. First, we will learn about the date and time class in Java with an example, and after that will learn about date and time in JShell with multiple examples. JShell JShell is an interactive command-line tool that allows us to learn, investigate, and explore the Java language and its API. We can type any valid Java code into the console and get immediate results without the need to write a verbose class with the main() method. C:\Users\User>jshell | Welcome to JShell -- Version ... Read More

Is it safe to delete a void pointer in C/C++?

Tapas Kumar Ghosh
Updated on 17-Jun-2025 16:21:04

1K+ Views

The void pointer is a pointer which is not associate with any data types. It points to some data location in storage means points to the address of variables. It is also called general purpose pointer. Is It Safe to Delete a Void Pointer in C/C++? It is not safe to delete a void pointer in C/C++ because delete needs to call the destructor of whatever object it's destroying, and it is impossible to do that if it doesn't know the type. C Example of Void Pointer In this example, a void pointer (void *p) can store the address of ... Read More

How to use range-based for() loop with std::map?

Tapas Kumar Ghosh
Updated on 17-Jun-2025 16:12:50

2K+ Views

In C++, a map is defined by an element storage container in the form of key-value pairs where each key is unique and mapped with a respective value. While range-based for loop is a very simple approach to iterate over elements in the container. In this article, we will learn the usage of range-based for loop over std::map in C++. Example Scenario Input: myMap: { {1, "Ravi"}, {2, "Tom"} } Output: 1: Ravi 2: Tom What is std::map? The std::map is an associative container that stores key-value pairs in sorted order. The maps are used for fast lookup, insertion, and deletion based on keys.Following is the basic ... Read More

Map function and Dictionary in Python to sum ASCII values

Yaswanth Varma
Updated on 17-Jun-2025 16:11:58

803 Views

In this article, we are going to learn how to use the map() function along with dictionaries to add the ASCII values of characters in the string. The Python built-in ord() function returns the ASCII integer value of a character. Additionally, dictionaries (dict) in Python are used to store key-value pairs. We use them to associate strings with their total ASCII values, making it easy to store and retrieve the result. Before diving into the examples, let's have a quick look at the Python map() function and the Python ord() function. Python map() Function The Python map() function ... Read More

Python program to create 3D list.

Yaswanth Varma
Updated on 17-Jun-2025 16:04:10

2K+ Views

In Python, A 3D list is also called a three-dimensional array (list of lists of lists). It can be visualized as a cube or a set of tables stacked together. It is commonly used to represent data with three indices. For example, a matrix of images (height, width, depth). In this article, we are going to learn how to create a 3D list. As Python does not have built-in support for multi-dimensional arrays like other programming languages, but using the nested lists and loops, we can create and manipulate 3D lists. Creating a 3D List In the following example, ... Read More

Python program to remove all duplicates word from a given sentence.

Yaswanth Varma
Updated on 17-Jun-2025 15:58:09

629 Views

In this article, we are going to learn how to remove all the duplicate words from the given sentence. Generally, we will encounter situations where the sentence contains the same word repeated multiple times. These duplicate words make the text look messy and can affect further processing. Removing duplicates will help to improve the readability and ensure each word appears only once in the final sentence. Using Python split() Method The Python split() method is used to split all the words in the string using the specified separator. The separator can be a comma, full-stop, or any ... Read More

Program to check if a number is Positive, Negative, Odd, Even, Zero?

Samual Sam
Updated on 17-Jun-2025 15:57:24

7K+ Views

In this article, we are going to learn how to check if the number is positive, negative, odd, even, or zero. Identifying and categorizing a number based on its characteristics is a basic operation. A number can fall into multiple categories: Positive: A number is greater than 0. Negative: A number less than 0. Zero: The number that is equal to 0. Even: The number that is divisible by 2. Odd: The number that is not divisible by 2. Let's dive into the ... Read More

What is the most efficient string concatenation method in python?

Yaswanth Varma
Updated on 17-Jun-2025 15:45:36

3K+ Views

String concatenation is the process of joining two or more strings together. It is important to choose the right method for string concatenation when dealing with building output, logging messages, etc. While Python has several methods to concatenate strings, not all the methods perform equally, especially incase of nested loops. In this article, we will explore the different methods of string concatenation in Python. Using Python + Operator The first approach is by using the + operator, which is the straightforward way to concatenate strings. This method is inefficient in loops because it creates a new string object ... Read More

Advertisements