Karthikeya Boyini has Published 2193 Articles

FloatBuffer asReadOnlyBuffer() method in Java

karthikeya Boyini

karthikeya Boyini

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

103 Views

A read-only float buffer can be created using the contents of a buffer with the method asReadOnlyBuffer() in the class java.nio.FloatBuffer. The new buffer cannot have any modifications as it is a read-only buffer. However, the capacity, positions, limits etc. of the new buffer are the same as the previous ... Read More

How to use remove() in android ConcurrentLinkedQueue?

karthikeya Boyini

karthikeya Boyini

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

127 Views

Before getting into an example, we should know what ConcurrentLinkedQueue is, it is an unbounded queue based on linked nodes. Multiple threads can access queue elements with safety. Elements travel based on queue strategy as FIFO and elements going to insert from a tail. It does not allow null values.This ... Read More

LocalDate get() method in Java

karthikeya Boyini

karthikeya Boyini

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

115 Views

The value of the specified field from the LocalDate can be obtained using the get() method in the LocalDate class in Java. This method requires a single parameter i.e. ChronoField that is required and it returns the value of the specified field from the LocalDate.A program that demonstrates this is ... Read More

How to use remove() in android CopyOnWriteArraySet?

karthikeya Boyini

karthikeya Boyini

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

138 Views

Before getting into the example, we should know what CopyOnWriteArraySet is. It is a thread-safe variant of ArrayList and operations add, set, and so on by making a fresh copy of the underlying array.This example demonstrates about How to use remove () in android CopyOnWriteArraySetStep 1 − Create a new ... Read More

DoubleBuffer arrayOffset() method in Java

karthikeya Boyini

karthikeya Boyini

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

91 Views

The offset of the first element of the buffer inside the buffer array is obtained using the method arrayOffset() in the class java.nio.DoubleBuffer. If the buffer backed by the array is read-only, then the ReadOnlyBufferException is thrown.A program that demonstrates this is given as follows −Example Live Demoimport java.nio.*; import java.util.*; ... Read More

LocalDateTime plusNanos() method in Java

karthikeya Boyini

karthikeya Boyini

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

156 Views

An immutable copy of a LocalDateTime object where some nanoseconds are added to it can be obtained using the plusNanos() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the number of nanoseconds to be added and it returns the LocalDateTime object with the added ... Read More

How to fill array values in Java?

karthikeya Boyini

karthikeya Boyini

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

3K+ Views

Let us first create an int array −int[] arr = new int[10];Now, fill array values. Here, the numbers get added from the index 2 to 7 −Arrays.fill(arr, 2, 7, 100);Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String[] args) {       int[] arr = new ... Read More

DoubleBuffer put() method in Java

karthikeya Boyini

karthikeya Boyini

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

105 Views

The required value can be written at the current position of the buffer and then the current position is incremented using the method put() in the class java.nio.DoubleBuffer. This method requires a single parameter i.e. the value to be written in the buffer and it returns the buffer in which ... Read More

LocalDateTime plusSeconds() method in Java

karthikeya Boyini

karthikeya Boyini

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

142 Views

An immutable copy of a LocalDateTime object where some seconds are added to it can be obtained using the plusSeconds() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the number of seconds to be added and it returns the LocalDateTime object with the added ... Read More

LocalDateTime until() Method in Java

karthikeya Boyini

karthikeya Boyini

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

6K+ Views

The difference between two LocalDateTime objects can be obtained using the until() method in the LocalDateTime class in Java. This method requires two parameters i.e. the end date for the LocalDateTime object and the Temporal unit. Also, it returns the difference between two LocalDateTime objects in the Temporal unit specified.A ... Read More

Advertisements