Arjun Thakur has Published 1025 Articles

What is AbstractSequentialList class in Java?

Arjun Thakur

Arjun Thakur

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

431 Views

The AbstractSequentialList class provides an implementation of the List interface. For an unmodifiable list, implement the list iterator's hasNext, next, hasPrevious, previous and index methods. For a modifiable list the programmer should implement the list iterator's set method.The syntax is as followspublic abstract class AbstractSequentialList extends AbstractListTo work with the ... Read More

Pull and add to set at the same time with MongoDB? Is it Possible?

Arjun Thakur

Arjun Thakur

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

823 Views

Yes, you can use pull and add at the same time with $addToSet and $pull operator. Let us first create a collection with documents> db.pullAndAddToSetDemo.insertOne({StudentScores : [78, 89, 90]} ... ); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9a797e15e86fd1496b38af") }Following is the query to display all documents from a ... Read More

How to use actual row count (COUNT(*)) in WHERE clause without writing the same query as subquery in MySql?

Arjun Thakur

Arjun Thakur

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

2K+ Views

Achieve this with the help of where clause.The syntax is as followsSELECT yourColumnName1, yourColumnName2, ...N FROM yourTableName WHERE (    SELECT COUNT(*) FROM yourTableName )=2;To understand the concept, let us create a table. The query to create a table is as followsmysql> create table CountWithSubqueryDemo    - > (   ... Read More

Get Distinct Values with Sorted Data in MongoDB?

Arjun Thakur

Arjun Thakur

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

1K+ Views

Following is the query to get distinct values with sorted data in MongoDBdb.yourCollectionName.distinct("yourFieldName").sort();Let us first create a collection with documents>db.getDistinctWithSortedDataDemo.insertOne({"StudentId":10, "StudentName":"John", "StudentAge":23}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9b1e3315e86fd1496b38c3") } >db.getDistinctWithSortedDataDemo.insertOne({"StudentId":20, "StudentName":"Carol", "StudentAge":21}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9b1e3e15e86fd1496b38c4") } >db.getDistinctWithSortedDataDemo.insertOne({"StudentId":10, "StudentName":"John", "StudentAge":23}); {   ... Read More

IntStream mapToDouble() method in Java

Arjun Thakur

Arjun Thakur

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

914 Views

The mapToDouble() method returns a DoubleStream consisting of the results of applying the given function to the elements of this stream.The syntax is as follows.DoubleStream mapToDouble(IntToDoubleFunction mapper)Here, the parameter mapper is the stateless function applied to each element.Create an IntStream with some elements.IntStream intStream = IntStream.of(5, 20, 25, 45, 60, ... Read More

How do I view the auto_increment value for a table in MySQL?

Arjun Thakur

Arjun Thakur

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

2K+ Views

In order to view the auto_increment value for a table, you can use SHOW TABLE command.The syntax is as followsSHOW TABLE STATUS LIKE 'yourTableName'\GThe syntax is as followsSELECT `AUTO_INCREMENT`    FROM `information_schema`.`TABLES`    WHERE `TABLE_SCHEMA` = ‘yourDatabaseName’    AND `TABLE_NAME` =’yourTableName';To understand the above syntaxes, let us create a table. ... Read More

Read and Write the stack in 8085 Microprocessor

Arjun Thakur

Arjun Thakur

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

2K+ Views

Reading from the StackLet us consider that SP contents the address FC78H, and we want to read information from a stack location. In this case, we are not interested in reading from a location whose address is less than the memory address present in SP. This is because 8085 interprets ... Read More

How to change the password in MongoDB for existing user?

Arjun Thakur

Arjun Thakur

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

896 Views

To change the password in MongoDB for existing user, you can use changeUserPassword(). Following is the syntaxdb.changeUserPassword("yourExistingUserName", "yourPassword");Let us first switch the database to admin. Following is the syntax> use adminThis will produce the following outputswitched to db adminNow, display users from the database. Following is the query> db.getUsers();This will ... Read More

How to create a new table from merging two tables with MySQL union?

Arjun Thakur

Arjun Thakur

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

3K+ Views

The following is the syntax to merge two tables using MySQL unioncreate table yourTableName ( select *from yourTableName1 ) UNION ( select *from yourTableName2 );To understand the above syntax, let us create a table. The query to create first table is as followsmysql> create ... Read More

Difference between call and jump instructions in 8085 Microprocessor

Arjun Thakur

Arjun Thakur

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

4K+ Views

The main differences between a JMP instruction and a CALL instruction is as follows –If a JMP instruction is executed, we jump to the destination location, and the execution carries on from there, without bothering to come back later to the instruction after the JMP. On the other hand, if ... Read More

Advertisements