Samual Sam has Published 2310 Articles

How to use pollFirst() in android ConcurrentLinkedDeque?

Samual Sam

Samual Sam

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

130 Views

Before getting into an 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 pollFirst() in android ConcurrentLinkedDequeStep 1 − Create a new project in Android Studio, go to File ⇒ ... Read More

Implementing own Hash Table with Open Addressing Linear Probing in C++

Samual Sam

Samual Sam

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

1K+ Views

A hash table is a data structure which is used to store key-value pairs. Hash function is used by hash table to compute an index into an array in which an element will be inserted or searched.Linear probing is a collision resolving technique in Open Addressed Hash tables. In this ... Read More

Java Program to get Sub Map from TreeMap

Samual Sam

Samual Sam

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

130 Views

To get Sub Map from TreeMap, let us first create a TreeMap and set key-value pair −TreeMaptMap = new TreeMap(); tMap.put("1", "A"); tMap.put("2", "B"); tMap.put("3", "C"); tMap.put("4", "D"); tMap.put("5", "E"); tMap.put("6", "F"); tMap.put("7", "G");Now, let’s say you need to get submap from 3 to 7. For that, use the method ... Read More

How to use pool() in android LinkedBlockingDeque?

Samual Sam

Samual Sam

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

137 Views

Before getting into an 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 a constructor and helps to provide memory wastage in android.This example demonstrates about How to ... Read More

Checking if a HashSet contains certain value in Java

Samual Sam

Samual Sam

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

862 Views

Let’s say the following is our Integer array −Integer arr[] = { 50, 100, 150, 200, 250, 300 };Set the above integer array in HashSet −Setset = new HashSet(Arrays.asList(arr));Now, let us check whether the HashSet contains certain value or not −set.contains(150)TRUE is returned if the value is in the List, ... Read More

How to use pool() in android ConcurrentLinkedQueue?

Samual Sam

Samual Sam

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

136 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 isAfter() method in Java

Samual Sam

Samual Sam

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

2K+ Views

It can be checked if a particular LocalDate is after the other LocalDate in a timeline using the isAfter() 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 LocalDate object is after ... Read More

How to use push() in android ConcurrentLinkedDeque?

Samual Sam

Samual Sam

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

122 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

FloatBuffer duplicate() method in Java

Samual Sam

Samual Sam

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

108 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

1K+ 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

Advertisements