Aishwarya Naglot has Published 180 Articles

How do you add an element to a list in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 10-Jun-2025 15:16:37

29K+ Views

List in Java is part of the Java Collections Framework, and it is used for storing elements in a sequential manner. It allows duplicate elements but keeps the order of insertion. The List interface is implemented by various classes such as ArrayList, LinkedList, and Vector. In this article, we will ... Read More

How do I set the size of a list in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 10-Jun-2025 15:08:24

9K+ Views

Java list size is dynamic. It increases automatically whenever you add an element to it, and this exceeds the initial capacity. You can define the initial capacity at the time of list creation so that it allocates memory after the initial capacity is exhausted. We can do this using the ... Read More

Java program to display time in different country’s format

Aishwarya Naglot

Aishwarya Naglot

Updated on 10-Jun-2025 14:47:26

673 Views

In this article, we will learn how to display the current date in different country formats using Java. We can import java.time package to work with the date and time API. The java.time package, along with the DateFormat and Locale classes, allows us to format the date according to various regions' ... Read More

Java Program to Display Dates of Calendar Year in Different Format

Aishwarya Naglot

Aishwarya Naglot

Updated on 10-Jun-2025 14:43:48

399 Views

In this article, we will understand how to display dates of a calendar year in different formats. Java has a built-in Date class, but it is recommended to use the java.time package, to work with the modern date and time API. The package includes many date and time classes. Following ... Read More

Java Program to Iterate over ArrayList using Lambda Expression

Aishwarya Naglot

Aishwarya Naglot

Updated on 10-Jun-2025 14:26:28

3K+ Views

The ArrayList class is a resizable array that can be found in java.util package. The difference between a built-in array and an ArrayList in Java is that the size of an array cannot be modified. Lambda Expression is a feature that was introduced in Java 8. It is useful when ... Read More

Java Program to Recursively Linearly Search an Element in an Array

Aishwarya Naglot

Aishwarya Naglot

Updated on 05-Jun-2025 14:59:33

3K+ Views

Linear Search on a Java Array using RecursivelyLinear search is an algorithm that we use to check if an element is present in an array or not. It checks all the elements of the array one by one until it finds the element or reaches the end of the array. ... Read More

How can we convert a JSON array to a list using Jackson in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 05-Jun-2025 14:58:10

9K+ Views

Jackson is a Java-based library, and it can be useful for converting Java objects to JSON and JSON to Java objects. A Jackson API is faster than other API, needs less memory, and is good for large objects. We can convert a JSON array to a list using the ObjectMapper ... Read More

Java Program To Determine If a Given Matrix is a Sparse Matrix

Aishwarya Naglot

Aishwarya Naglot

Updated on 05-Jun-2025 14:42:35

424 Views

What is a Sparse Matrix? A matrix is said to be a sparse matrix if most of the elements of that matrix are 0. It means that the number of non-zero elements has a lesser count than the number of zero elements.Let's say we have a matrix of size 3*3, ... Read More

How do I get length of list of lists in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 05-Jun-2025 14:39:21

4K+ Views

In Java, a list is a collection that we use for storing elements. In many cases, we need to get the length of a list of lists. In this article, we will learn how to get the length of a list of lists in Java. List provides a method size() ... Read More

How do you create a list with values in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 05-Jun-2025 14:14:10

886 Views

A List is a Collection in Java that is used for storing elements in sequence. In this article, we will be learning how to create a list with values in Java. Ways to Create a List with Values in Java There are various ways to create a list with values ... Read More

Previous 1 ... 7 8 9 10 11 ... 18 Next
Advertisements