Nishtha Thakur has Published 564 Articles

LongStream forEachOrdered() method in Java

Nishtha Thakur

Nishtha Thakur

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

63 Views

The forEachOrdered() method in Java performs an action for each element of this stream, guaranteeing that each element is processed in encounter order for streams that have a defined encounter order.The syntax is as follows −void forEachOrdered(LongConsumer action)Here, parameter wrapper is a non-interfering action to perform on the elements. LongConsumer ... Read More

Structure vs class in C++

Nishtha Thakur

Nishtha Thakur

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

158 Views

In C++ the structure and class are basically the same. But there are some minor differences. These differences are like below.The class members are private by default, but members of structures are public. Let us see these two codes to see the differences.Example Code Live Demo#include using namespace std; class ... Read More

Set find() function in C++ STL

Nishtha Thakur

Nishtha Thakur

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

451 Views

Set find() function in C++ STL returns an iterator to the element which is searched in the set container. The iterator points to the position just after the last element in the set, if the element is not found.AlgorithmBegin    Define function printS() to print elements of set container.   ... Read More

Encode and decode binhex4 files using Python (binhex)

Nishtha Thakur

Nishtha Thakur

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

383 Views

The binhex module encodes and decodes files in binhex4 format. This format is used in the representation of Macintosh files in ASCII. Only the data fork is handled.The binhex module defines the following functions −binhex.binhex(input, output): Convert a binary file with filename input to binhex file output. The output parameter can ... Read More

Create Octet Tuple from a List collection in Java

Nishtha Thakur

Nishtha Thakur

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

79 Views

Create Octel Tuple from List collection as well using the fromCollection() method in Java. Let us first see what we need to work with JavaTuples. To work with Octet class in JavaTuples, you need to import the following package −import org.javatuples.Octet;Note − Download JavaTuples Jar library to run JavaTuples program. ... Read More

Prettyprint in MongoDB shell as default?

Nishtha Thakur

Nishtha Thakur

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

150 Views

You can call pretty() function on cursor object to prettyprint in MongoDB shell. The syntax is as follows −db.yourCollectionName.find().pretty();To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −>db.prettyDemo.insertOne({"ClientName":"Larry", "ClientAge":27, "ClientFavoriteCountry":["US", "UK"]}); {    "acknowledged" : ... Read More

Match between fields in MongoDB aggregation framework?

Nishtha Thakur

Nishtha Thakur

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

182 Views

      You can use $cmp operator for this. To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.matchBetweenFieldsDemo.insertOne({"FirstValue":40, "SecondValue":70}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c92c9625259fcd19549980d") } > db.matchBetweenFieldsDemo.insertOne({"FirstValue":20, "SecondValue":5}); ... Read More

Set vs Map in C++ STL

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

Set is an abstract data type in which each element has to be unique because the value of the element identifies it. The value of the element cannot be modified once it is added to the set, but it is possible to remove and add the modified value of that ... Read More

The isEmpty() method of Java AbstractCollection class

Nishtha Thakur

Nishtha Thakur

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

236 Views

The isEmpty() method of the AbstractCollection class checks whether the collection is empty or not i.e. whether it has zero elements. It returns if the Collectionn has no elements.The syntax is as follows −public boolean isEmpty()To work with AbstractCollection class in Java, import the following package −import java.util.AbstractCollection;The following is ... Read More

match max_size() function in C++ STL

Nishtha Thakur

Nishtha Thakur

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

70 Views

The match max_size() function in C++ STL returns the maximum number of elements in the match_results object that can be held by the match container.This function does not accept a parameter.Example Code Live Demo#include #include using namespace std; int main() {    match_results m;    cout

Advertisements