Samual Sam has Published 2492 Articles

How to use push() in android ConcurrentLinkedDeque?

Samual Sam

Samual Sam

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

58 Views

Before getting into the example, we should know what ConcurrentLinkedDeque is, it is unbounded deque based on linked nodes. Multiple threads can access deque elements with safety.This example demonstrates about How to use push() in android ConcurrentLinkedDequeStep 1 − Create a new project in Android Studio, go to File ⇒ ... Read More

Java Program to get display name for Day of Week in different locale

Samual Sam

Samual Sam

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

227 Views

To get the display name for Day of Week in different locale, let us first get the default −Locale locale = Locale.getDefault();Now, let’s say we want to consider Canada locale −Locale locale1 = Locale.CANADA;Now, get the Day of Week name for locale default and Canada −System.out.printf("%s%n", DayOfWeek.THURSDAY.minus(2).getDisplayName(TextStyle.SHORT, locale)); System.out.printf("%s%n", DayOfWeek.THURSDAY.minus(2).getDisplayName(TextStyle.SHORT, ... Read More

FloatBuffer duplicate() method in Java

Samual Sam

Samual Sam

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

72 Views

A duplicate buffer of a buffer can be created using the method duplicate() in the class java.nio.FloatBuffer. This duplicate buffer is identical to the original buffer. The method duplicate() returns the duplicate buffer that was created.A program that demonstrates this is given as follows −Example Live Demoimport java.nio.*; import java.util.*; public ... Read More

LocalDate isEqual() method in Java

Samual Sam

Samual Sam

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

988 Views

It can be checked if two LocalDate objects are equal or not using the isEqual() method in the LocalDate class in Java. This method requires a single parameter i.e. the LocalDate object that is to be compared. It returns true if the two LocalDate objects are equal and false otherwise.A ... Read More

How to use putLast() in android LinkedBlockingDeque?

Samual Sam

Samual Sam

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

73 Views

Before getting into example, we should know what LinkedBlockingDeque is. It is implemented by Collection interface and the AbstractQueue class. It provides optional boundaries based on linked nodes.It going to pass memory size to constructor and helps to provide memory wastage in android.This example demonstrate about How to use putLast ... Read More

Java Program to get first Friday in a month

Samual Sam

Samual Sam

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

453 Views

At first, set a date −LocalDate date = LocalDate.of(2019, Month.APRIL, 1);Now, get the first Friday using the firstInMonth() method. Here, you have to set DayOfWeek as Friday since we want the first Friday in a month −LocalDate firstFriday = date.with(TemporalAdjusters.firstInMonth(DayOfWeek.FRIDAY));Example Live Demoimport java.time.DayOfWeek; import java.time.LocalDate; import java.time.Month; import java.time.temporal.TemporalAdjusters; public class ... Read More

LocalDate compareTo() method

Samual Sam

Samual Sam

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

3K+ Views

Two LocalDate objects can be compared using the compareTo() method in the LocalDate class in Java. This method requires a single parameter i.e. the LocalDate object to be compared.If the first LocalDate object is greater than the second LocalDate object it returns a positive number, if the first LocalDate object ... Read More

How to use remainingCapacity() in android PriorityBlockingQueue?

Samual Sam

Samual Sam

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

74 Views

Before getting into the example, we should know what PriorityBlockingQueue is. It is an unbounded queue and follows the same order as a priority queue. The main usage of priority blocking queue is, it going to handle out of memory error.This example demonstrates about How to use remainingCapacity() in android ... Read More

Java Program to adjust Adjust LocalDate to first Day Of next month with TemporalAdjusters class

Samual Sam

Samual Sam

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

233 Views

Let us first set a date −LocalDate localDate = LocalDate.of(2019, Month.JUNE, 15);Now, adjust LocalDate to first Day of next month −LocalDate day = localDate.with(TemporalAdjusters.firstDayOfNextMonth());Example Live Demoimport java.time.LocalDate; import java.time.Month; import java.time.temporal.TemporalAdjusters; public class Demo {    public static void main(String[] args) {       LocalDate localDate = LocalDate.of(2019, Month.JUNE, 15); ... Read More

LocalDate from() method in Java

Samual Sam

Samual Sam

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

81 Views

An instance of a LocalDate object can be obtained from a Temporal object using the from() method in the LocalDate class in Java. This method requires a single parameter i.e. the Temporal object and it returns the LocalDate object that is obtained from the Temporal object.A program that demonstrates this ... Read More

Advertisements