Nancy Den has Published 330 Articles

The clear() method of CopyOnWriteArrayListin Java

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

60 Views

To remove all the elements from the CopyOnWriteArrayList, use the clear() method. It empties the list.The syntax is as follows:void clear()To work with CopyOnWriteArrayList class, you need to import the following package:import java.util.concurrent.CopyOnWriteArrayList;The following is an example to implement CopyOnWriteArrayList class clear() method in Java:Example Live Demoimport java.util.concurrent.CopyOnWriteArrayList; public class Demo ... Read More

How to insert current date and time in a database using JDBC?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

5K+ Views

The time stamp dataType in MySQL database stores day, month, year, hour, minute, second, fractional seconds. Using this you can represent date and time at once.There are two ways to insert/get current time stamp values while working with JDBC.Using the database default value for a date.Using the getTime() method of ... Read More

LongStream range() method in Java

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

334 Views

The range() method of the LongStream class in Java returns a sequential ordered LongStream from startInclusive to endExclusive by an incremental step of 1. This is inclusive of the initial element and exclusive of the last element.The syntax is as follows:static LongStream range(long startInclusive, long endExclusive)Here, startInclusive is the first ... Read More

C++ Program to Implement Insertion Sort

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

16K+ Views

This sorting technique is similar with the card sorting technique, in other words we sort cards using insertion sort mechanism. For this technique, we pick up one element from the data set and shift the data elements to make a place to insert back the picked up element into the ... Read More

C++ Program to Implement Shell Sort

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

1K+ Views

The shell sorting technique is based on the insertion sort. In the insertion sort sometimes we need to shift large block to insert item in the correct location. Using shell sort, we can avoid large number of shifting. The sorting is done with specific interval. After each pass the interval ... Read More

LocalTime getNano() method in Java

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

153 Views

The nanosecond of second for a particular LocalTime can be obtained using the getNano() method in the LocalTime class in Java. This method requires no parameters and it returns the nanosecond of second in the range of 0 to 999, 999, 999.A program that demonstrates this is given as followsExample Live ... Read More

C++ Program to Implement Counting Sort

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

4K+ Views

Counting sort is a stable sorting technique, which is used to sort objects according the keys that are small numbers. It counts the number of keys whose key values are same. This sorting technique is efficient when difference between different keys are not so big, otherwise it can increase the ... Read More

What is batch processing in JDBC?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

217 Views

Grouping related SQL statements into a batch and executing/submitting them at once is known as batch processing.While executing a set of statements one after other the execution switches from the database to program simultaneously.Using batch processing we can reduce this communication overhead and increase the performance of our Java application.For ... Read More

C++ Program to Implement Interpolation Search Algorithm

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

922 Views

For the binary search technique, the lists are divided into equal parts. For the interpolation searching technique, the procedure will try to locate the exact position using interpolation formula. After finding the estimated location, it can separate the list using that location. As it tries to find exact location every ... Read More

Write an example JDBC program demonstrating the batch processing with statement object?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

115 Views

Grouping related SQL statements into a batch and executing/submitting them at once is known as batch processing. The Statement interface provides methods to perform batch processing such as addBatch(), executeBatch(), clearBatch().Follow the steps given below to perform batch updates using the Statement object:Register the driver class using the registerDriver() method ... Read More

Advertisements