Find and Edit Text Values Starting from Consonant in Android

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

103 Views

This example demonstrate about How to find edit text values start from consonant or not.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 above code, we have taken edit text and button view to verify edit text data is starting with a consonant.Step 3− Add the following code to java/MainActivity.xmlpackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity ... Read More

LongStream noneMatch Method in Java

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

151 Views

The noneMatch() method of the LongStream class in Java returns whether no elements of this stream match the provided predicate.The syntax is as followsboolean noneMatch(LongPredicate predicate)Here, the parameter predicate is a stateless predicate to apply to elements of this stream. However, LongPredicate in the syntax represents a predicate (boolean-valued function) of one long-valued argument.To use the LongStream class in Java, import the following packageimport java.util.stream.LongStream;The method returns true if either no elements of the stream match the provided predicate or the stream is empty. The following is an example to implement LongStream noneMatch() method in JavaExample Live Demoimport java.util.stream.LongStream; public class ... Read More

LongStream distinct Method in Java

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

58 Views

The distinct() method in the LongStream class returns a stream consisting of the distinct elements of this stream.The syntax is as follows.LongStream distinct()To use the LongStream class in Java, import the following package.import java.util.stream.LongStream;Create a LongStream and add elements.LongStream longStream = LongStream.of(100L, 150L, 100L, 300L, 150L, 500L);Now, get the distinct elements.longStream.distinct().The following is an example to implement LongStream distinct() method in Java. Here, we have repeated elements in the stream.Example Live Demoimport java.util.stream.LongStream; public class Demo {    public static void main(String[] args) {       LongStream longStream = LongStream.of(100L, 150L, 100L, 300L, 150L, 500L);       System.out.println("Distinct elements..."); ... Read More

Find a Document with ObjectId in MongoDB

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

323 Views

To find a document with Objectid in MongoDB, use the following syntax −db.yourCollectionName.find({"_id":ObjectId("yourObjectIdValue")}).pretty();To understand the above syntax, let us create a collection with the document. The query to create a collection with a document is as follows −> db.findDocumentWithObjectIdDemo.insertOne({"UserName":"Larry"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c90e4384afe5c1d2279d69b") } > db.findDocumentWithObjectIdDemo.insertOne({"UserName":"Mike", "UserAge":23}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c90e4444afe5c1d2279d69c") } > db.findDocumentWithObjectIdDemo.insertOne({"UserName":"Carol", "UserAge":26, "UserHobby":["Learning", "Photography"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c90e4704afe5c1d2279d69d") }Display all documents from a collection with the help of find() method. The query is as follows −> db.findDocumentWithObjectIdDemo.find().pretty();The following is the output ... Read More

The contains Method of Java AbstractCollection Class

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

129 Views

The contains() method of the AbstractCollection class checks whether an element is in the AbstractCollection or not. It returns a Boolean i.e. TRUE if the element is in the collection, else FALSE is returned.The syntax is as follows:public boolean contains(Object ele)Here, ele is the element to be checked for existence.To work with AbstractCollection class in Java, import the following package:import java.util.AbstractCollection;The following is an example to implement AbstractCollection contains() method in Java:Example Live Demoimport java.util.ArrayList; import java.util.AbstractCollection; public class Demo {    public static void main(String[] args) {       AbstractCollection absCollection = new ArrayList();       absCollection.add("Football");   ... Read More

MongoDB Query for Not Equal to Null or Empty

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

7K+ Views

To set a query for not equal to null or empty, use the $nin operator. The syntax is as followsdb.yourCollectionName.find({yourFieldName:{$nin:[null, ""]}});Let us create a collection with documents> db.notEqualToNullOrEmptyDemo.insertOne({"UserName":"Larry", "UserAge":24}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d20b6a629b87623db1b26") } > db.notEqualToNullOrEmptyDemo.insertOne({"UserName":"", "UserAge":29}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d20bea629b87623db1b27") } > db.notEqualToNullOrEmptyDemo.insertOne({"UserName":"Sam", "UserAge":32}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d20c7a629b87623db1b28") } > db.notEqualToNullOrEmptyDemo.insertOne({"UserName":null, "UserAge":27}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d20d2a629b87623db1b29") } > db.notEqualToNullOrEmptyDemo.insertOne({"UserName":"Robert", "UserAge":26}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d20dda629b87623db1b2a") } > db.notEqualToNullOrEmptyDemo.insertOne({"UserName":"", "UserAge":23}); {    "acknowledged" : true,   ... Read More

Perform Complex MySQL Insert Using CONCAT

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

2K+ Views

To perform complex MySQL insert, you can use CONCAT() function. Let us see an example and create a table with StudentId and StudentFirstName.After that, complex MySQL insert will be performed and 'Web Student’ text will get inserted for every value and unique StudentId will get concatenated.The query to create first table is as follows −mysql> create table DemoTable (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentFirstName varchar(20) ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentFirstName) values('John'); Query OK, 1 row affected (0.16 sec) mysql> insert ... Read More

Add Two 8-Bit BCD Numbers in 8086

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

6K+ Views

In this program we will see how to add two 8-bit BCD numbers.Problem StatementWrite 8086 Assembly language program to add two 8-bit BCD number stored in memory address offset 600.DiscussionThis task is too simple. Here we are taking the numbers from memory and after adding we need to put DAA instruction to adjust the accumulator content to decimal form. The DAA will check the AC and CY flags to adjust a number to its decimal form.InputAddressData……5009950125…… Flow Diagram Program OutputAddressData……6002560101…… 

SetAt0 Method for Septet Class in Java Tuples

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

103 Views

The setAt0() method is used to set the Septet value in JavaTuples and a copy with new value at the specified index i.e. index 0 here.Let us first see what we need to work with JavaTuples. To work with Septet class in JavaTuples, you need to import the following package −import org.javatuples.Septet;Note − Steps to download and run JavaTuples program. If you are using Eclipse IDE to run Septet Class in JavaTuples, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file.The following is an example −Exampleimport org.javatuples.Septet; import ... Read More

Use of JSP text Action Element

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

160 Views

The action can be used to write the template text in JSP pages and documents. Following is the simple syntax for this action −Template dataThe body of the template cannot contain other elements; it can only contain text and EL expressions (Note − EL expressions are explained in a subsequent chapter). Note that in XML files, you cannot use expressions such as ${whatever > 0}, because the greater than signs are illegal. Instead, use the gt form, such as ${whatever gt 0} or an alternative is to embed the value in a CDATA section.]]>If you need to include a ... Read More

Advertisements