Smita Kapse has Published 560 Articles

LongStream sequential() method in Java

Smita Kapse

Smita Kapse

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

67 Views

The sequential() method of the LongStream class in Java returns an equivalent stream that is sequential.The syntax is as follows −LongStream sequential()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, 70L, 100L, 150L, 200L, 300L);Now, return ... Read More

Implicit initialization of variables with 0 or 1 in C

Smita Kapse

Smita Kapse

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

189 Views

We know that we need to declare variables before using it in our code. However, we variables can be assigned with 0 or 1 without declaration. In the following example we can see this.Example#include #include x, y, array[3]; // implicit initialization of some variables int main(i) {   ... Read More

How to use changes () in Android sqlite?

Smita Kapse

Smita Kapse

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

266 Views

Before getting into an example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built-in SQLite database implementation. SQLite supports all the relational database features. In order to ... Read More

Find all duplicate documents in a MongoDB collection by a key field?

Smita Kapse

Smita Kapse

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

270 Views

Use the aggregate framework to find all duplicate documents in a MongoDB collection by a key field.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.findDuplicateByKeyDemo.insertOne({"StudentId":1, "StudentName":"John"}); {    "acknowledged" : true,    "insertedId" ... Read More

How to remove all common character from string array elements in android?

Smita Kapse

Smita Kapse

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

197 Views

This example demonstrate about How to remove all common character from string array elements 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. ... Read More

Search for a value in Java Octet Tuple

Smita Kapse

Smita Kapse

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

54 Views

To search for a value in Java Octet Tuple, you need to use the contains() method. The method returns a Boolean value stating whether the element set as a parameter exists in the values set in Octet Tuple or not. Let us first see what we need to work with ... Read More

mbtowc function in C

Smita Kapse

Smita Kapse

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

46 Views

The C library function int mbtowc(whcar_t *pwc, const char *str, size_t n) converts a multibyte sequence to a wide character.Following is the declaration for mbtowc() function.int mbtowc(whcar_t *pwc, const char *str, size_t n)The parameters are −pwc − This is the pointer to an object of type wchar_t.str − This is ... Read More

Restrict keyword in C

Smita Kapse

Smita Kapse

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

1K+ Views

Here we will see what is the restrict keyword in C. The restrict keyword first introduced in C99 version. Let us see what is actually this restrict keyword.The restrict keyword is used for pointer declarations as a type quantifier of the pointer.This keyword does not add new functionalities. Using this ... Read More

How to Reverse a linked list in android?

Smita Kapse

Smita Kapse

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

138 Views

This example demonstrate about How to reverse a linked list 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

Avoid duplicate entries in MongoDB?

Smita Kapse

Smita Kapse

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

931 Views

To avoid duplicate entries in MongoDB, you can use createIndex(). The syntax is as follows −db.yourCollectionName.createIndex({"yourFieldName":1}, {unique:true});Let us implement the above syntax. The query to avoid duplicate entries in MongoDB is a follows −> db.avoidDuplicateEntriesDemo.createIndex({"UserName":1}, {unique:true}); {    "createdCollectionAutomatically" : true,    "numIndexesBefore" : 1,    "numIndexesAfter" : 2,   ... Read More

Advertisements