George John has Published 1167 Articles

LongStream noneMatch() method in Java

George John

George John

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

93 Views

The noneMatch() method of the LongStream class in Java returns whether no elements of this stream match the provided predicate.The syntax is as followsboolean noneMatch(LongPredicate predicate)Here, the parameter predicate is a stateless predicate to apply to elements of this stream. However, LongPredicate in the syntax represents a predicate (boolean-valued function) ... Read More

Insert to specific index for MongoDB array?

George John

George John

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

434 Views

To insert a specific index for MongoDB array, you can use $push operator. Let us create a collection with documents>db.insertToSpecificIndexDemo.insertOne({"StudentName":"Larry", "StudentSubjects":["MySQL", "Java"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d2562a629b87623db1b2c") } >db.insertToSpecificIndexDemo.insertOne({"StudentName":"Chris", "StudentSubjects":["C++", "C"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d2573a629b87623db1b2d") }Following is the query to display ... Read More

What implicit objects are supported by JSP?

George John

George John

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

118 Views

Following table lists out the nine Implicit Objects that JSP supports −Sr.No.Object & Description1requestThis is the HttpServletRequest object associated with the request.2responseThis is the HttpServletResponse object associated with the response to the client.3outThis is the PrintWriter object used to send output to the client.4sessionThis is the HttpSession object associated with ... Read More

How to use $slice operator to get last element of array in MongoDB?

George John

George John

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

710 Views

To get the last element of array in MongoDB, use the following syntaxdb.yourCollectionName.find({}, {yourArrayFieldName:{$slice:-1}});Let us first create a collection with documents>db.getLastElementOfArrayDemo.insertOne({"StudentName":"James", "StudentMathScore":[78, 68, 98]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d2d71a629b87623db1b2e") } >db.getLastElementOfArrayDemo.insertOne({"StudentName":"Chris", "StudentMathScore":[88, 56, 34]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d2d83a629b87623db1b2f") } >db.getLastElementOfArrayDemo.insertOne({"StudentName":"Larry", "StudentMathScore":[99]}); ... Read More

8085 Program to do an operation on two BCD numbers based on the contents of X

George John

George John

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

74 Views

Now let us see a program of Intel 8085 Microprocessor. In this program we will see how to do different operations on BCD numbers based on choice.Problem Statement:Write 8085 Assembly language program to perform some operations on two 8-bit BCD numbers base on choice.Discussion:In this program we are taking a ... Read More

How to get full screen activity in android?

George John

George John

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

4K+ Views

This example demonstrate about How to get full screen activity in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the ... Read More

LongStream count() method in Java

George John

George John

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

76 Views

The count() method of the LongStream class in Java is used to return the count of elements in this stream.The syntax is as follows.long count()To use the LongStream class in Java, import the following package.import java.util.stream.LongStream;Create a LongStream and add some elements.LongStream longStream = LongStream.of(50L, 30L, 80L, 40L, 15L, 60L);Now, ... Read More

C++ Program to Represent Graph Using Incidence List

George John

George John

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

220 Views

This program represents a graph using incidence list and the time complexity of this algorithm is O(e).AlgorithmBegin Take the input of the number of vertex ‘v’ and edges ‘e’ and also take the input of ‘e’ pairs of vertexes of the given graph in ... Read More

IntStream asDoubleStream() method in Java

George John

George John

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

139 Views

The asDoubleStream() method in the IntStream class returns a DoubleStream consisting of the elements of this stream, converted to double.The syntax is as followsDoubleStream asDoubleStream()First, create an IntStreamIntStream intStream = IntStream.of(20, 30, 40, 50, 60, 70, 80);After that, convert it to double with asDoubleStream() methodDoubleStream doubleStream = intStream.asDoubleStream();The following is ... Read More

How can I sum columns across multiple tables in MySQL?

George John

George John

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

1K+ Views

To sum columns across multiple tables, use UNION ALL. To understand the concept, let us create first table. The query to create first table is as followsmysql> create table Products1    -> (    -> ProductId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> ProductName varchar(20),    -> ProductPrice int ... Read More

Advertisements