Karthikeya Boyini has Published 2383 Articles

LinkedBlockingQueue Class in Java

karthikeya Boyini

karthikeya Boyini

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

100 Views

The LinkedBlockingQueue Class in Java has a blocking queue that is optionally bounded and based on linked nodes. This means that if the capacity is provided then the LinkedBlockingQueue is bound, otherwise it is not bound. Also, FIFO for ordering elements.A program that demonstrates this is given as follows −Example Live ... Read More

How to maps key to the localized message and performs the parametric replacement in a JSP?

karthikeya Boyini

karthikeya Boyini

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

141 Views

The tag maps key to the localized message and performs the parametric replacement.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultkeyMessage key to retrieveNoBodybundleResource bundle to useNoDefault bundlevarName of the variable to store the localized messageNoPrint to pagescopeThe scope of the variable to store the localized messageNoPageExample ... Read More

Sorting a vector in C++

karthikeya Boyini

karthikeya Boyini

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

16K+ Views

Sorting a vector in C++ can be done by using std::sort(). It is defined in header. To get a stable sort std::stable_sort is used. It is exactly like sort() but maintains the relative order of equal elements. Quicksort(), mergesort() can also be used, as per requirement.AlgorithmBegin    Decalre v of ... Read More

How to remove all elements from a Collection in another Collection

karthikeya Boyini

karthikeya Boyini

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

451 Views

Let’s say the following is our Collection i.e. ArrayList −Listlist = new ArrayList(); list.add(100); list.add(200); list.add(200); list.add(200); list.add(300); list.add(400); list.add(400); list.add(500);Now, create another Collection −List list2 = new ArrayList(); list2.add(100); list2.add(200); list2.add(300); list2.add(400);To remove all elements from a Collection in another Collection, try the following with list and list2 as ... Read More

CharBuffer duplicate() method in Java

karthikeya Boyini

karthikeya Boyini

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

73 Views

A duplicate buffer of a buffer can be created using the method duplicate() in the class java.nio.CharBuffer. 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

How to change MySQL error message language?

karthikeya Boyini

karthikeya Boyini

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

157 Views

You can use lc_messages to change MySQL error message language. The syntax is as follows −SET lc_messages = 'yourLanguage';To understand the concept, let us create a table with some error and check the error message language.Here, we have set the local message to French. Let us first create a table ... Read More

Which library can be used to interact with database in JSP?

karthikeya Boyini

karthikeya Boyini

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

160 Views

The JSTL SQL tag library provides tags for interacting with relational databases (RDBMSs) such as Oracle, MySQL, or Microsoft SQL Server.Following is the syntax to include JSTL SQL library in your JSP −Following table lists out the SQL JSTL Tags −S.No.Tag & Description1Creates a simple DataSource suitable only for prototyping2Executes ... Read More

How to shuffle a List in Java

karthikeya Boyini

karthikeya Boyini

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

155 Views

First, create an Integer array −Integer[] strArray = new Integer[] { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };Now, convert it into a List −Listlist = Arrays.asList(strArray);Use Collections to shuffle as shown below −Collections.shuffle(list);Example Live Demoimport java.util.Arrays; import java.util.Collections; import java.util.List; public class Demo {    public static ... Read More

PriorityBlockingQueue Class in Java

karthikeya Boyini

karthikeya Boyini

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

72 Views

The PriorityBlockingQueue Class in Java has a blocking queue that has unbounded functionality and is based on the class PriorityQueue with the same ordering rules. The PriorityBlockingQueue Class is a part of the Java Collection Framework.A program that demonstrates this is given as follows −Example Live Demoimport java.util.concurrent.PriorityBlockingQueue; public class Demo ... Read More

Program to iterate over a List using Java 8 Lambda

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

Let us first create a List and add elements −ArrayListarrayList = new ArrayList(); arrayList.add("100"); arrayList.add("200"); arrayList.add("300"); arrayList.add("400"); arrayList.add("500");Now, iterate over it with Lambda Expressions −ArrayListlist = arrayList; System.out.println("Iterating..."); list.stream().forEach(elem -> System.out.println(elem));Example Live Demoimport java.util.ArrayList; import java.util.List; public class Demo {    public static void main(String[] args) {       ArrayListarrayList ... Read More

Advertisements