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

Static Nested Classes in Java

Rishi Raj
Updated on 30-Jul-2019 22:30:24

403 Views

A nested class in Java is of two types i.e. Static nested class and Inner class. A static nested class is a nested class that is declared as static. A nested nested class cannot access the data members and methods of the outer class.A program that demonstrates a static nested class is given as follows:Example Live Demopublic class Class1 {    static class Class2 {       public void func() {          System.out.println("This is a static nested class");       }    }    public static void main(String args[]) {       Class1.Class2 obj = ... Read More

Can MySQL INT Type Be Non-Zero NULL?

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

294 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

Remove Specified Element from Java LinkedHashSet

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

785 Views

To remove a specified element from LinkedHashSet, use the remove() and include the element you want to remove as a parameter.First, set LinkedHashSet and add elements −LinkedHashSet hashSet = new LinkedHashSet(); hashSet.add(10); hashSet.add(20); hashSet.add(30); hashSet.add(40); hashSet.add(50); hashSet.add(60);Let us now remove an element −hashSet.remove(10);The following is an example to remove specified element from LinkedHashSet −Example Live Demoimport java.util.LinkedHashSet; public class Demo { public static void main(String[] args) { LinkedHashSet hashSet = new LinkedHashSet(); hashSet.add(10); hashSet.add(20); ... Read More

Wuthering Heights: A Classic Victorian Novel

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

4K+ Views

Victorian writers were focusing on the dialogue and immediate action was witnessed by Wuthering Heights because it was tagged as a ‘rude’ and ‘coarse‘ piece of writing. Later commentators like C.P. Sanger in his famous essay, The Structure of Wuthering Heights, published in 1926, demonstrated in detail the accuracy of novel’s time scheme, topography, legal processes, and the strange symmetry of the family tree.Wuthering Heights As A ClassicWuthering Heights is not only a classic novel but also a pioneering text of the Gothic genre. It feels chaotic human emotions, with realness mixed with themes of death and supernatural events. Even ... Read More

Remove Shadow Below Action Bar in Android

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

2K+ Views

By default, android provides shadow for action bar. This example demonstrates How to remove shadow below the action bar.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.     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.widget.TextView; public class MainActivity extends AppCompatActivity {    int view = R.layout.activity_main;    TextView text;    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)    @Override    protected void onCreate(Bundle savedInstanceState) ... Read More

General Data Link Layer Frame Structure

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

2K+ Views

Framing in Data Link LayerIn the physical layer, data transmission involves synchronised transmission of bits from the source to the destination. The data link layer packs these bits into frames. 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 assembles them into frames.General Structure of a FrameA frame has the following parts:Frame Header: It contains the source and the destination addresses of the frame and the ... Read More

Advertisements