Chandu yadav has Published 1163 Articles

The toArray() method of AbstractSequentialList in Java

Chandu yadav

Chandu yadav

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

57 Views

The toArray() method is inherited from the AbstractCollection() method. It returns an array containing similar elements in this collection.The syntax is as followspublic Object[] toArray()To work with the AbstractSequentialList class in Java, you need to import the following packageimport java.util.AbstractSequentialList;The following is an example to implement AbstractSequentialList toArray() method in ... Read More

The toArray() method of Java AbstractCollection class

Chandu yadav

Chandu yadav

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

85 Views

The toArray() method of the AbstractCollection class is used to return the elements in this collection. The elements are returned in the form of an array.The syntax is as followspublic Object[] toArray()To work with AbstractCollection class in Java, import the following packageimport java.util.AbstractCollection;At first, declare AbstractCollection and add some elementsAbstractCollection ... Read More

Search a string with special characters in a MongoDB document?

Chandu yadav

Chandu yadav

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

2K+ Views

To search a string with special characters in MongoDB document, you can use \. Here, we have special character $ in our string.Let us first implement the following query to create a collection with documents>db.searchDocumentWithSpecialCharactersDemo.insertOne({"UserId":"Smith$John123", "UserFirstName":"John", "UserLastName":"Smith"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c987b98330fd0aa0d2fe4b1") } >db.searchDocumentWithSpecialCharactersDemo.insertOne({"UserId":"Taylor$Carol983", "UserFirstName":"Carol", "UserLastName":"Taylor"}); ... Read More

How to add a “created at” column in a table to set the timestamp in MySQL?

Chandu yadav

Chandu yadav

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

3K+ Views

You need to use ALTER command to add a created at column to an already created table in MySQL.Let us first create a table. The query to create a table is as follows. Here is your table without the “created at” columnmysql> create table formDemo - > ... Read More

IntStream allMatch() method in Java

Chandu yadav

Chandu yadav

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

475 Views

The allMatch() method of the IntStream class in Java returns whether all elements of this stream match the provided predicate.The syntax is as followsboolean allMatch(IntPredicate predicate)Here, the predicate parameter is a stateless predicate to apply to elements of this stream. The IntPredicate represents a predicate of one int-valued argument.The allMatch() ... Read More

How to get all the collections from all the MongoDB databases?

Chandu yadav

Chandu yadav

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

440 Views

To get all the collections from all the databases, let us first get all the databases using the following query> switchDatabaseAdmin = db.getSiblingDB("admin"); admin > allDatabaseName = switchDatabaseAdmin.runCommand({ "listDatabases": 1 }).databases;This will produce the following output[    {       "name" : "admin",       "sizeOnDisk" : 495616, ... Read More

Change a MySQL Column datatype from text to timestamp?

Chandu yadav

Chandu yadav

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

3K+ Views

To change a MySQL column datatype from text to timestamp, you need to use ALTER command.The syntax is as followsALTER TABLE yourTableName MODIFY COLUMN yourColumnName TIMESTAMP;To understand the above syntax, let us create a table.The query to create a table is as followsmysql> create table textTotimestampdemo    - > ( ... Read More

LongStream forEach() method in Java

Chandu yadav

Chandu yadav

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

117 Views

The forEach() method of the LongStream class in Java performs an action for each element of this stream.The syntax is as followsvoid forEach(LongConsumer action)Here, the parameter action is a non-interfering action to perform on the elements. LongConsumer represents an operation that accepts a single long-valued argument and returns no result.To ... Read More

Search for a text in MongoDBs Double Nested Array?

Chandu yadav

Chandu yadav

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

91 Views

Search for a text in MongoDBs Double Nested Array with the help of dot(.) notation. Let us first create a collection. Following is the query to create a collection with documents> db.doubleNestedArrayDemo.insertOne( ...    { ...       "StudentId" : "1000", ...       "StudentName" : "Larry", ... ... Read More

How to get default device sdk version in android?

Chandu yadav

Chandu yadav

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

139 Views

This example demonstrate about How to get default device sdk version 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 ... Read More

Advertisements