NavigableSet Class Higher Method in Java

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

144 Views

The higher() method in NavigableSet returns the least element strictly greater than the given element i.e. 35 here −higher(35);The following is an example to implement the higher method in Java −Example Live Demoimport java.util.NavigableSet; import java.util.TreeSet; public class Demo { public static void main(String[] args) { NavigableSet set = new TreeSet(); set.add(10); set.add(25); set.add(40); set.add(55); set.add(70); set.add(85); set.add(100); System.out.println("Returned Value = " + set.higher(35)); } }OutputReturned Value = 40

Sort HashMap Based on Keys in Java

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

327 Views

Firstly, create a HashMap −HashMap hm = new HashMap();Add some elements to the HashMap −hm.put("Shirts", new Integer(700)); hm.put("Trousers", new Integer(600)); hm.put("Jeans", new Integer(1200)); hm.put("Android TV", new Integer(450)); hm.put("Air Purifiers", new Integer(300)); hm.put("Food Processors", new Integer(950));Now, sort the HashMap based on keys using TreeMap −Map sort = new TreeMap(hm); System.out.println("Sorted Map based on key = "+sort);The following is an example to sort HasMap based on keys −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]) { HashMap hm = new HashMap(); hm.put("Shirts", new ... Read More

What is WAN Accelerator

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

662 Views

A wide area network accelerator (WAN accelerator) is a hardware component, a software, or an appliance executing in a virtualized environment that provides caching and optimization of WAN services. A WAN accelerator is also called a WAN optimizer or application accelerator.Working PrincipleA WAN accelerator provides services to speed up information flow between the end users for imparting better network experience. Its target is to reduce the data volume to be transmitted. So, it compresses data and uses data deduplication techniques. The accelerator caches duplicate data and sends references of them when they are needed multiple times instead of resending the ... Read More

Select Rows Where Two Columns Do Not Have the Same Value in MySQL

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

1K+ Views

You can use != operator from MySQL for this. The syntax is as follows:SELECT *FROM yourTableName WHERE yourColumnName1 !=yourColumnName2 OR (yourColumnName1 IS NULL AND yourColumnName2IS NOT NULL) OR (yourColumnName2 IS NULL AND yourColumnName1 IS NOT NULL);To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table selectTwoColumns    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> FirstNumber int,    -> SecondNumber int,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.87 sec)Insert some records in the table using insert command. The query is ... Read More

Add Elements to LinkedHashMap Collection in Java

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

3K+ Views

Use the put() method to add elements to LinkedHashMap collection.First, let us create a LinkedHashMap −LinkedHashMap l = new LinkedHashMap();Now, add elements −l.put("1", "Jack"); l.put("2", "Tom"); l.put("3", "Jimmy"); l.put("4", "Morgan"); l.put("5", "Tim"); l.put("6", "Brad");The following is an example to add elements to LinkedHashMap collection −Example Live Demoimport java.util.LinkedHashMap; public class Demo { public static void main(String[] args) { LinkedHashMap l = new LinkedHashMap(); l.put("1", "Jack"); l.put("2", "Tom"); l.put("3", "Jimmy"); ... Read More

Convert ArrayList to HashSet in Java

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

1K+ Views

To convert ArrayList to HashSet, firstly create an ArrayList −List l = new ArrayList();Add elements to the ArrayList −l.add("Accent"); l.add("Speech"); l.add("Diction"); l.add("Tone"); l.add("Pronunciation");Now convert the ArrayList to HashSet −Set s = new HashSet(l);The following is an example to convert an ArrayList to HashSet in Java.Example Live Demoimport java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.HashSet; public class Main { public static void main(String[] args) { List l = new ArrayList(); l.add("Accent"); l.add("Speech"); l.add("Diction"); ... Read More

What is Network Acceleration

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

3K+ Views

Network acceleration is a set of techniques used to increase the speed of information flow between the end users for imparting better network experience. It is also known as WAN optimization or WAN acceleration.Techniques involved in Network AccelerationTraffic Shaping: Priority is assigned to network traffic on whose basis bandwidth is allocated.Data Deduplication and Data Caching: Duplicate data is cached and references of them are sent for additional requests of the same data. This reduces the data volume for remote backups, replication, and disaster recovery.Compression: The size of data is reduced to lower bandwidth usage.Choice of Protocols: High performance protocols are ... Read More

Can MySQL INT Type Be Non-Zero NULL?

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

337 Views

You can set the INT column to value NULL.The column INT type a nullable column. The syntax is as follows:INSERT INTO yourTableName(yourIntColumnName) values(NULL);To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table nullableIntDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Price int,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.80 sec)Insert the record as NULL for a int column ‘Price’. The query is as follows:mysql> insert into nullableIntDemo(Price) values(NULL); Query OK, 1 row affected (0.11 sec) mysql> insert into ... Read More

Headers Used in a Data Link Layer

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

2K+ Views

Data Link Layer FrameA frame is a unit of communication in the data link layer. Data link layer takes the packets from the Network Layer and encapsulates them into frames. If the frame size becomes too large, then the packet may be divided into small sized frames. At receiver’ end, data link layer picks up signals from hardware and reassembles them into frames.Frame Structure and Frame HeaderA frame is composed of four types of fields, namely kind, seq, 𝑎𝑐𝑘 and info. The first three fields contain control information about the frame and collectively form the frame header. Besides, the frame ... Read More

Use asList Method of Arrays Class to Create a Vector Object

Jai Janardhan
Updated on 30-Jul-2019 22:30:24

2K+ Views

A Vector can be created from an Array using the java.util.Arrays.asList() method.A program that demonstrates this is given as follows:Example Live Demoimport java.util.Arrays; import java.util.Vector; public class Demo {    public static void main(String args[]) {       Integer[] arr = { 3, 1, 9, 6, 4, 8, 7 };       Vector vec = new Vector(Arrays.asList(arr));       System.out.println("The Vector elements are: " + vec);    } }OutputThe Vector elements are: [3, 1, 9, 6, 4, 8, 7]Now let us understand the above program.The Integer Array arr[] is defined. Then a Vector is created using the ... Read More

Advertisements