Use Iterator and the values() method to iterate through the values of TreeMap.Let us first create a TreeMap and add some elements −TreeMap m = new TreeMap(); m.put(1, "PHP"); m.put(2, "jQuery"); m.put(3, "JavaScript"); m.put(4, "Ruby"); m.put(5, "Java"); m.put(6, "AngularJS"); m.put(7, "ExpressJS");Iterate through the values −Collection res = m.values(); Iterator i = res.iterator(); while (i.hasNext()) { System.out.println(i.next()); }The following is the complete example to iterate through the values −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]) { TreeMap m = new TreeMap(); m.put(1, "PHP"); m.put(2, "jQuery"); ... Read More
You need to use ALTER command to change collation to utf8_bin. The syntax is as follows:ALTER TABLE yourTableName COLLATE utf8_general_ci;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table CollateDemo -> ( -> Id int NOT NULL AUTO_INCREMENT, -> Name varchar(20), -> Age int, -> PRIMARY KEY(Id) -> ); Query OK, 0 rows affected (0.98 sec)Check the DDL of the table. The syntax is as follows:SHOW CREATE TABLE yourTableName;Let us now check the DDL of our table:mysql> show create table CollateDemo;The following is ... Read More
To show a MySQL warning, you can use the below syntax −SHOW WARNINGS;The above syntax only displays the immediate warning from MySQL prompt. Suppose you run another query between them or you have lost the MySQL connection, then SHOW WARNINGS will not work.Here is the query to display warnings −mysql> SHOW WARNINGS;Here is the output that displays immediate warning −+-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Level | Code | Message ... Read More
SQLSQL is a type of language that can be used to utilize your database. It is a base language for databases like MySQL, SQL Server, Oracle etc. SQL stands for Structure Query Language and it can be used to utilize the relational database management system.This can also be used for accessing, manipulating and updating data in the database using some commands. The SQL commands are as follows −SELECTUPDATE, etc.SQL can also be used in the creation of schema as well as controlling the data access.MySQLMySQL is a relational database management system that utilizes the SQL command. MySQL provides the tools ... Read More
Earth rotates around its own axis which is tilted at 23.5 degrees, from the plane of its orbit around the sun, in the eastward direction. It takes almost 24 hours to complete one rotation. The Earth rotates at a speed of 460 m/s, that is approximately 1650 km/hr at the equator. The angular velocity of the Earth decreases as we keep moving toward the poles.The Earth's rotational speed is slowing down with time. According to atomic clocks, the present day is 1.7 milliseconds slower than a century ago. It is not a big issue as it will take more than ... Read More
The floorEntry() NavigableMap method returns a key-value mapping associated with the greatest key less than or equal to the given keyThe following is an example to implement floorEntry() method −Example 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, "Kurt"); n.put(19, "Tiger"); n.put(24, "Jacob"); System.out.println("NavigableMap elements..."+n); System.out.println("Floor Entry = "+n.floorEntry(5)); } }OutputNavigableMap elements... {1=Tim, 4=Jackie, 5=Tom, 9=John, 14=Jamie, 15=Kurt, 19=Tiger, 24=Jacob} Floor Entry 5=Tom
You can use CREATE TABLE command to create a table from an existing table. The syntax is as follows:CREATE TABLE yourNewTableName LIKE yourOldTableNameTo understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table ShowCreateTableCommand -> ( -> Id int NOT NULL AUTO_INCREMENT, -> FirstName varchar(20), -> LastName varchar(20), -> Age int, -> TotalMarks int, -> PRIMARY KEY(Id) -> ); Query OK, 0 rows affected (1.22 sec)Here is the query to describe a table using DESC command. The query is as follows:mysql> desc ... Read More
Are you crazy to get your dream job and find it difficult to chose between Naukri.com and LinkedIn? Before I give any verdict, let's first have a look at the features of both the platforms:Naukri.comNaukri.com is a mass driven platform. There are recruiters who range from small to large firms but here you find most of the recruiters are from the small units.The profiles of users are not easily comparable.The profiles of users are accessible.The provision of referrals and recommendations does not associate itself to Naukri.comThere is no provision to track an individual, who is actively looking for a job ... Read More
Create a HashMap −HashMap hm = new HashMap();Add elements to the HashMap that we will be displaying afterward −hm.put("Maths", new Integer(98)); hm.put("Science", new Integer(90)); hm.put("English", new Integer(97)); hm.put("Physics", new Integer(91));Now, to display the HashMap elements, use Iterator. The following is an example to display HashMap elements −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]) { // Create a hash map HashMap hm = new HashMap(); // Put elements to the map ... Read More
Technology Symbolizes the Advancement of Human Knowledge. It is truly a boon. The advantages are many and the list can go on and on and on.They are:Chemotherapy can help cure cancer.It has made the world a global village. Emails, Whatsapp, and other social media have connected people sitting miles away.We can easily communicate sitting anywhere, anytime.One can use the camera to save memories of important events.Food can be cooked faster in Microwave ovens and electric cookers.The mixer grinders help in the easy grinding of food, and juicers help in extracting juice out of fruits and vegetables.Cell phones are certainly the ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP