A TreeMap cannot contain duplicate keys. TreeMap cannot contain the null key. However, It can have null values.Let us first see how to create a TreeMap −TreeMap m = new TreeMap();Add some elements in the form of key-value pairs −m.put(1, "India"); m.put(2, "US"); m.put(3, "Australia"); m.put(4, "Netherlands"); m.put(5, "Canada");The following is an example to create a TreeMap and add key-value pairs −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]) { TreeMap m = new TreeMap(); m.put(1, "India"); m.put(2, "US"); m.put(3, "Australia"); ... Read More
When a new product developed, the Research and Development department initiate and perform an intensive study and get the details to support the project. Research and Development departments help corporations stay ahead of the competition, utilize new technology, and produce goods more efficiently. This is just the purpose of any research.Research PhaseThe research phase includes determining product specifications, production costs, and a production timeline.It contributes to the development, as a scientist or inventor in the field of Science and Technology. The research plan is a map for one’s career as a research science professional.In the medical field, research enables us ... Read More
The java.io.File class has display constants File.separatorChar and File.pathSeparatorChar mainly. The File.separatorChar is ‘/’ and the File.pathSeparatorChar is ‘:’ for Unix.A program that demonstrates this is given as follows −Example Live Demoimport java.io.File; public class Demo { public static void main(String[] args) { try { System.out.println("File.pathSeparatorChar = " + File.pathSeparatorChar); System.out.println("File.separatorChar = " + File.separatorChar); } catch(Exception e) { e.printStackTrace(); } } }The output of the above program is as follows −OutputFile.pathSeparatorChar = : File.separatorChar = /Now let ... Read More
You can count all rows per table with the help of aggregate function count (TABLE_ROWS) from informatio_schema.tables. The syntax is as follows −SELECT table_name, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'yourDatabaseName';Now you can apply the above syntax to get all rows per table. The query is as follows −mysql> SELECT table_name, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'business';Here is the output −+------------------------------------------------------------------+------------+ | TABLE_NAME | TABLE_ROWS | +------------------------------------------------------------------+------------+ | accentsearchdemo ... Read More
You can compare DATE string with string from DATETIME field with the help of DATE() function in MySQL.The syntax is as follows −select *from yourTableName where DATE(yourColumnName) = ’anyDateString’;To understand the above syntax, let us create a table and set some datetime values in the table. The query to create a table −mysql> create table DateTimeDemo −> ( −> ArrivalTime datetime −> ); Query OK, 0 rows affected (0.61 sec)Let us insert some records in the table with the help of insert command. The following is the query to insert records ... Read More
The pollFirstEntry() method in NavigableMap remove and return a key-value mapping associated with the least key in this mapThe following is an example to implement pollFirstEntry() methodExample Live Demoimport java.util.*; public class Demo { public static void main(String[] args) { NavigableMap n = new TreeMap(); n.put(5, "Tom"); n.put(9, "John"); n.put(14, "Jamie"); n.put(1, "Tim"); n.put(4, "Jackie"); n.put(15, ... Read More
This example demonstrates how to make a smooth image rotation 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 the above code, we have taken a text view and image view. When you click on text view, Image will get rotate in anti clock direction.Step 3 - Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.animation.Animation; import android.view.animation.LinearInterpolator; ... Read More
A file or directory with the required abstract pathname can be deleted when the program ends i.e. after the virtual machine terminates using the method java.io.File.deleteOnExit(). This method requires no parameters and it does not return a value.A program that demonstrates this is given as follows −Example Live Demoimport java.io.File; public class Demo { public static void main(String[] args) { try { File file = new File("demo1.txt"); file.createNewFile(); System.out.println("File: " + file); file.deleteOnExit(); } catch(Exception e) { ... Read More
Being techy, I have tried almost all the existing search engines up till now and finally, I have come to the conclusion that Google stands way above than the rest at least for the time being. Know exactly why?Google search engine uses a powerful tool to filter your search. Without Google, it is practically impossible to find information based on your need.Google uses a special algorithm to generate results and however, it shares the general information and facts about its algorithm but the specifics are confidential and are a company secret.Google uses automated programs named Spider or Crawler and what ... Read More
To store query result in a variable with MySQL, use the SET command. The syntax is as follows −SET @anyVariableName = ( yourQuery);To understand the above concept, let us create a table. The following is the query to create a table −mysql> create table QueryResultDemo −> ( −> Price int −> ); Query OK, 0 rows affected (0.59 sec)Now let us insert some records into the table. The following is the query to insert records −mysql> insert into QueryResultDemo values(100); Query OK, 1 row affected (0.17 sec) mysql> insert into QueryResultDemo values(20); Query OK, 1 row ... Read More