Smita Kapse has Published 498 Articles

LongStream sequential() method in Java

Smita Kapse

Smita Kapse

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

102 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

288 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

384 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

398 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

287 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

108 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

96 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

How to Reverse a linked list in android?

Smita Kapse

Smita Kapse

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

214 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

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

The setAtX() method of the Octet Tuple in Java

Smita Kapse

Smita Kapse

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

134 Views

The setAtX() method is used to set Octet value in Java. Here, X is the index wherein you need to set the value i.e. to set value at index 1, use the setAt1() and value as a parameter.Let us first see what we need to work with JavaTuples. To work ... Read More

Advertisements