Deepti S has Published 25 Articles

Final vs Immutability in Java

Deepti S

Deepti S

Updated on 19-Dec-2024 14:04:21

2K+ Views

The final keyword in Java may be employed to define a constant value as well as prevent a variable, method, or class from being changed or overridden. On the other side, immutability describes an object's characteristic of keeping a constant state across the course of its existence. The values of ... Read More

How to iterate LinkedHashMap in Java?

Deepti S

Deepti S

Updated on 19-Oct-2023 12:23:08

3K+ Views

LinkedHashMap is a class that is identical to HashMap, however it additionally provides a feature that tracks the order wherein components are inserted. The sequence wherein elements were added isn't preserved by using HashMap, even though it does permit for quick element insertion, search, and deletion. By keeping a linked ... Read More

How to Iterate Through HashTable in Java?

Deepti S

Deepti S

Updated on 19-Oct-2023 12:20:05

3K+ Views

The HashTable is a fundamental data structure that operates on the basis of key hashcodes without preserving the insertion order. It prohibits duplicate keys but allows for duplicate values. Remarkably, it accommodates a wide range of objects for both keys and values, fostering heterogeneity. Null values for keys and values ... Read More

How to Iterate LinkedList in Java?

Deepti S

Deepti S

Updated on 19-Oct-2023 12:16:22

300 Views

The LinkedHashMap Class is similar to HashMap. But it has an additional feature in comparison to HashMap. The LinkedList class belongs to the java.util package. A doubly linked list is how LinkedList stores its elements. Given that our operations typically include insertion and deletion, LinkedList is the best option. The ... Read More

How to Iterate the Vector Elements in the Reverse Order in Java?

Deepti S

Deepti S

Updated on 18-Oct-2023 16:35:11

285 Views

The Vector class has been a part of the Java collection system since Java version 1.2. Vectors are sometimes known as Dynamic Arrays because, unlike ordinary arrays, they can expand and contract in size. Ensuring thread-safety, Vectors are synchronized. While there exists a third approach that involves using Apache Commons ... Read More

How to Invoke Method by Name in Java Dynamically Using Reflection?

Deepti S

Deepti S

Updated on 18-Oct-2023 16:29:33

1K+ Views

The Reflection API in Java allows you to dynamically call any method using its string name. When using the java.lang.reflect API, you can load classes by name even if they aren't accessible at compile time thanks to reflection's robust mechanism. It empowers you to dynamically invoke any method using reflection ... Read More

How to Iterate HashMap in Java?

Deepti S

Deepti S

Updated on 18-Oct-2023 16:24:21

855 Views

(Key, Value) pairs are used to store data in Java HashMap collections. Although it is unsynchronized, it is comparable to HashTable. As a result, a HashMap can be accessed by numerous threads without encountering any troubles. Despite the fact that HashMap allows for the storage of null keys as well, ... Read More

How to iterate over a 2D list (list of lists) in Java?

Deepti S

Deepti S

Updated on 18-Oct-2023 16:03:46

3K+ Views

A data structure known as a 2D list or list of lists can be utilised for saving a collection of data in a two-dimensional format. A row in the 2D list is represented by each inner list in this list of lists. A 2D list could be utilised, for instance, ... Read More

How to Iterate LinkedHashMap in Reverse Order in Java?

Deepti S

Deepti S

Updated on 18-Oct-2023 16:01:17

2K+ Views

The LinkedHashMap serves the purpose of maintaining the precise order of element addition. It elucidates the method for accessing elements in the sequence they were inserted. In addition to storing values based on their keys, the LinkedHashMap class expands upon the functionalities of the Hash Map class and implements the ... Read More

Explain character classes in Java regular expressions

Deepti S

Deepti S

Updated on 29-Aug-2023 15:47:34

411 Views

Java regular expressions, is often known as rege. It is employed for searching and manipulating text. They are utilized in numerous applications. Online scraping, email screening, and password validation are a few of them.A pattern that can be employed to match a specific character sequence in a string is also ... Read More

Advertisements