Smita Kapse has Published 498 Articles

Collectors averagingDouble() method in Java 8

Smita Kapse

Smita Kapse

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

562 Views

The averagingDouble() method of the Collectors class in Java 8 returns a Collector that is the arithmetic mean of a double-valued function applied to the input elements.The syntax is as follows −public static Collector averagingDouble(ToDoubleFunction

C++ Program to Find a Good Feedback Edge Set in a Graph

Smita Kapse

Smita Kapse

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

211 Views

In this Program we will basically find a feedback arc set which contains edges which when removed from the graph, graph becomes directed acyclic graph.AlgorithmBegin function checkCG(int n) : n: number of vertices. arr: struct graph variable. Initialize cnt = 0 and size = (n-1). For i =0 to n-1 ... Read More

How to use hash set in Android?

Smita Kapse

Smita Kapse

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

409 Views

This example demonstrate How to use hash set in AndroidStep 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

StringJoiner add() method in Java 8

Smita Kapse

Smita Kapse

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

218 Views

The add() method of the StringJoiner class is used in Java 8 to add a copy of the given CharSequence value as the next element of the StringJoiner value. If the new element ele is null, then the value null gets added.The syntax is as follows −public StringJoiner add(CharSequence ele)Here, ... Read More

How to copy a collection from one database to another in MongoDB?

Smita Kapse

Smita Kapse

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

2K+ Views

In MongoDB, the command does not exist to copy a collection from one database to another. To achieve it, use the below concept −db.yourCollectionName.find().forEach(function(yourVariableName){    db.getSiblingDB('yourDestinationDatabase')['yourCollectionName'].insert(yourVariableName); });Let us create a collection in the test database and copy this collection to another database with the name „sample‟.To understand the above syntax, ... Read More

C++ Program to Find the Connected Components of an UnDirected Graph

Smita Kapse

Smita Kapse

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

890 Views

Weakly or Strongly Connected for a given a undirected graph can be found out using DFS. This is a C++ program of this problem.Functions usedBegin Function fillorder() = fill stack with all the vertices.    a) Mark the current node as visited and print it    b) Recur for all ... Read More

DoubleStream skip() method in Java

Smita Kapse

Smita Kapse

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

122 Views

The skip() method of the DoubleStream class in Java returns a stream consisting of the remaining elements of this stream after discarding the first numEle elements of the stream. The numEle is a parameter which you can set to skip any number of elements from the stream.The syntax is as ... Read More

How to use upper () in Android sqlite?

Smita Kapse

Smita Kapse

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

227 Views

Before getting into 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

C++ Program to Perform Baillie-PSW Primality Test

Smita Kapse

Smita Kapse

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

593 Views

The Baillie-PSW Primality Test, this test named after Robert Baillie, Carl Pomerance, John Selfridge, and Samuel Wagstaff. It is a test which tests whether a number is a composite number or possibly prime.AlgorithmMillerTest()Begin    Declare a function MillerTest of Boolean type.    Declare MT_dt and MT_num of integer datatype and ... Read More

How to print julianday in Android sqlite?

Smita Kapse

Smita Kapse

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

146 Views

Before getting into 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

Advertisements