A list can be sorted in reverse order i.e. descending order using the java.util.Collections.sort() method. This method requires two parameters i.e. the list to be sorted and the Collections.reverseOrder() that reverses the order of an element collection using a Comparator.The ClassCastException is thrown by the Collections.sort() method if there are mutually incomparable elements in the list.A program that demonstrates this is given as follows:Example Live Demoimport java.util.ArrayList; import java.util.Collections; import java.util.List; public class Demo { public static void main(String args[]) { List aList = new ArrayList(); ... Read More
The blue eyes technology works on Artificial Intelligence. It aims to give human abilities to a computer. A research team of IBM has come up with this technology to make a computer understand and sense human feelings and behavior.The aim of the blue eyes technology is to give human power or abilities to a computer so that the machine can naturally interact with human beings as humans interact with each other, through speech, facial expressions and touch.All human beings have some perceptual capabilities, the ability to understand each other’s emotional level or feelings from their facial expressions. Blue eyes technology ... Read More
Here we will see the addressing modes of the Zilog Z-80 Microprocessor. But at first we will discuss about the mnemonics of Z-80.As we know there are many similarities between Intel 8085 and Zilog Z-80, so we can also find the similarity on the instructions. But in Z-80 the Mnemonics are slightly different. The Hex codes are same, but only the mnemonics are different. So, if we want to execute a program, which was written in the 8085 MPU, it will work fine. But Z-80 has many other instructions, which are not available in the 8085.Here is the list of ... Read More
To get the sub set from TreeSet, use the subSet() method. Let us first create a TreeSet and add elements to it −TreeSet set = new TreeSet(); set.add("78"); set.add("56"); set.add("88"); set.add("54"); set.add("76"); set.add("34");Let us get the subset now from a range of elements −SortedSet sorted = set.subSet("54", "76");The following is an example to get sub set from Java TreeSet −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]){ TreeSet set = new TreeSet(); set.add("78"); set.add("56"); ... Read More
Marketing is a concept which is related to beliefs. With marketing, a consumer is made to believe that a certain product or service delivers the results mentioned. Whether it is digital or traditional, marketing is a tool to sell your product or service by gaining trust. But with the increasing attention towards digital marketing, there are many unethical practices prevailing. Recently, social media platforms like Facebook and YouTube have made their rules more stringent so as to avoid unethical practices in the digital marketing field.What Are They Like?It is unethical to do false marketing by conveying the false messages into ... Read More
This example demonstrates How to Dynamically Add Views into View.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 an empty layout. In this layout, we will have dynamic text view.package com.example.andy.myapplication; import android.graphics.Bitmap; import android.graphics.Matrix; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; public class MainActivity extends AppCompatActivity { int view = R.layout.activity_main; ... Read More
The extreme elements in a list are the maximum and minimum elements. These can be obtained using the java.util.Collections.max() and java.util.Collections.min() methods respectively.The Collections.max() method contains a single parameter i.e. the list whose maximum element is to be found and it returns the maximum element from the list. The Collections.min() method contains a single parameter i.e. the list whose minimum element is to be found and it returns the minimum element from the list.A program that demonstrates this is given as follows:Exampleimport java.util.Arrays; import java.util.Collections; import java.util.List; public class Demo { public static void main(String args[]) { ... Read More
Satire is a genre of English Literature which is very much confused with irony. It has the target is on the audience in a very indirect manner.Examples of Satire from English Literature:George Orwell's Animal FarmMark Twain's Adventures of Huckleberry FinnAbsolem and Achitophel by John DrydenThe Devil’s Dictionary by Ambrose BierceRestoration Age as the Age of SatireRestoration age was the age of satire with John Dryden, Jonathan Swift as the major political satirists. They pointed out the follies of the then Monarch and that too through their writings. One must not forget “Absalom and Achitophel “ as the gallery of portraits ... Read More
This example demonstrates how to Rotate image in image view by an angle.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 Image view and text view. When a user clicks on Text view, Image will rotate to the 20-degree angle.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.graphics.Bitmap; import android.graphics.Matrix; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; ... Read More
NULL and empty string ‘ ’ both aren’t similar in MySQL. To check the field is empty like ‘ ’or is null, you need to use the IS NULL property or something else. You can check all the conditions with CASE statement. The syntax is as follows:SELECT *, CASE WHEN yourColumnName =’ ‘ THEN ‘yourMessage1’ WHEN yourColumnName IS NULL THEN ‘yourMessage2’ ELSE CONCAT(yourColumnName ,' is a Name') END AS anyVariableName FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table checkFieldDemo -> ( -> Id int ... Read More