2173 Salk Avenue, Suite 250 Carlsbad, CA

support@assignmentprep.info

Please respond to the following discussion response with a minimum of 200 words and use a reference. ArrayList:

June 13, 2021
Christopher R. Teeple

Please respond to the following discussion response with a minimum of 200 words and use a reference.
ArrayList:
Characteristics:
ArrayList is used to store components and remove components at any  time because it is flexible to add and remove the components.
ArrayList is similar to arrays but the arrays were deterministic and ArrayList was non-deterministic.
ArrayList allows adding duplicate components.
ArrayList maintains the order of components in the order of insertion.
The following statement shows how to initialize the ArrayList.
ArrayList list=new ArrayList();
The above list object is used to add different types of components into ArrayList.
ArrayList list=new ArrayList();
The above list object is used to add only the String type component  into the ArrayList. If someone tries to add other types of components  then it provides a compile-time error.
The following statement shows how to add components into ArrayList.
list.add(“Cat”);
list.add(“Dog”);
list.add(“Cow”);
list.add(“Horse”);
add() is the method used to add components into the ArrayList. Here  the String type is specified so the parameters are enclosed with the  double-quotes. Instead of String Integer type is provided then the  number is passed as a parameter without double-quotes.
The following statement shows how to update components in ArrayList.
list.set(1,”Goat”);
Now the component at index 1 is set as Goat instead of Dog. In the  set() method the first parameter specifies the index value and the  second parameter specifies the updated component.
The following statements show how to get all the components that were stored in the ArrayList.
for(String str: list)
{
System.out.println(str);
}
From the above statement, the for-each loop is used to iterate the ArrayList to get all the components in the ArrayList.
Iterator it=list.iterator();
while(it.hasNext())
{
System.out.println(it.next());
}
From the above statement, the Iterator interface is used to get the ArrayList components.
The following statement shows how to remove components from the ArrayList.
list.remove(0);
Now the component at index 0 is deleted from the ArrayList.
The following is the java code that implements the ArrayList.
import java.util.*;
public class ArrayListDataStructure
{
public static void main(String[] args)
{
ArrayList list=new ArrayList();
list.add(“Cat”);
list.add(“Parrot”);
list.add(“Horse”);
list.add(“Cow”);
list.add(“Dog”);
System.out.println(“ArrayList Components”);
for(String str:list)
{
System.out.println(str);
}
list.set(2, “Golden Fish”);
System.out.println(“nArrayList Components after update”);
for(String st:list)
{
System.out.println(st);
}
System.out.println(“Size of ArrayList:”+list.size());
list.remove(3);
System.out.println(“nArrayList Components after Delete”);
for(String str:list)
{
System.out.println(str);
}
System.out.println(“Size of ArrayList:”+list.size());
list.add(“Love Birds”);
Collections.sort(list);
System.out.println(“nArrayList Components after Sorting”);
for(String str:list)
{
System.out.println(str);
}
}
}
LinkedList:
Characteristics of LinkedList are the same as ArrayList like  allowing duplicate components, components stored in the order of  insertion, and non synchronized.
The difference is that manipulation is fast in LinkedList as  compared to ArrayList because the ArrayList needs more shifting to  remove a component but the LinkedList does not need shifting.
The following statement shows how to initialize the LinkedList.
LinkedList ll=new LinkedList();
The following statement shows how to add components into LinkedList.
ll.add(“James”);
ll.add(“Daniel”);
ll.addFirst(“Hepson”);
ll.addLast(“Shibi”);
The following statement shows how to update components in LinkedList.
ll.set(2,”Anisha”);
The following statements show how to get all the components that were stored in the LinkedList.
for(String st:ll)
{
System.out.println(st);
}
The following statement shows how to remove components from LinkedList.
ll.remove(3);
The following is the java code that implements LinkedList.
import java.util.Collections;
import java.util.LinkedList;
public class LinkedListDataStructure
{
public static void main(String[] args)
{
LinkedList ll=new LinkedList();
ll.add(“Dhanya”);
ll.add(“Daniel”);
ll.add(“Xavier”);
ll.addFirst(“Hepson”);
ll.addLast(“Shibi”);
System.out.println(“LinkedList Components”);
for(String st:ll)
{
System.out.println(st);
}
ll.set(2,”Anisha”);
System.out.println(“nLinkedList Components after update”);
for(String st:ll)
{
System.out.println(st);
}
System.out.println(“Size of LinkedList:”+ll.size());
ll.remove(3);
System.out.println(“nLinkedList Components after Delete”);
for(String st:ll)
{
System.out.println(st);
}
System.out.println(“Size of LinkedList:”+ll.size());
Collections.sort(ll);
System.out.println(“nLinkedList Components after Sorting”);
for(String st:ll)
{
System.out.println(st);
}
}
}
Vector:
Vector is also a dynamic array so there is no size limit.
Vector class implements List interface so all the methods in List interface can be used in Vector.
Vector is synchronized so it is better to use vector in thread-safe implementation.
The following statement shows how to initialize a Vector class.
Vector vec=new Vector();
The following statement shows how to add components to a Vector.
v.addElement(“Cake”);
v.addElement(“Biscuit”);
v.addElement(“IceCream”);
v.addElement(“Chocolate”);
The following statement shows how to update components in Vector.
v.set(1,”Drinks”);
The following statement shows how to remove components from the Vector.
v.remove(3);
The following is the java code that implements Vector.
import java.util.Collections;
import java.util.Vector;
public class VectorDataStructure
{
public static void main(String[] args)
{
Vector v =new Vector();
v.addElement(“Cake”);
v.addElement(“Biscuit”);
v.addElement(“IceCream”);
v.addElement(“Chocolate”);
System.out.println(“Vector Components”);
for(String st:v)
{
System.out.println(st);
}
v.set(1,”Drinks”);
System.out.println(“nVector Components after update”);
for(String st:v)
{
System.out.println(st);
}
System.out.println(“Size of Vector:”+v.size());
v.remove(3);
System.out.println(“nVector Components after Delete”);
for(String st:v)
{
System.out.println(st);
}
System.out.println(“Size of Vector:”+v.size());
v.add(“Biscuit”);
Collections.sort(v);
System.out.println(“nVector Components after Sorting”);
for(String st:v)
{
System.out.println(st);
}
}
}
ArrayList:
The ArrayList is a resizable array that can be used to store  different types of components at any time. In ArrayList components can  be added anywhere by specifying the index.
The following is the description of the code
Initialize an ArrayList class.
Use add() method to add components into the ArrayList class.
For-each loop is used to print the components.
Use the set() method to update the component.
Use the remove() method to delete the component.
Use size() to get the current size of the ArrayList.
Use the sort() method in Collections to sort the components in the ArrayList.
LinkedList:
LinkedList class is used to implement the Linked List linear data  structure. The components are not stored in the neighboring address and  it is stored as containers.
The following is the description of the code.
Initialize the LinkedList class.
Use add() method to add components into the LinkedList class.
For-each loop is used to print the components.
Use the set() method to update the component.
Use the remove() method to delete the component.
Use size() to get the current size of the LinkedList.
Use the sort() method in Collections to sort the components in the LinkedList.
Snip of the Output:
Vector:
Vector is the growable array. Vector is synchronized so it has legacy  methods. Iterators can not be returned by the vector class because if  any concurrent changes occur then it throws the  ConcurrentModificationException.
The following is the description of the code
Initialize the Vector class.
Use and elements() method to add components into the Vector class.
For-each loop is used to print the components.
Use the set() method to update the component.
Use the remove() method to delete the component.
Use size() to get the current size of the Vector.
Use the sort() method in Collections to sort the components in the Vector.

Struggling With a Similar Paper? Get Reliable Help Now.

Delivered on time. Plagiarism-free. Good Grades.

What is this?

It’s a homework service designed by a team of 23 writers based in Carlsbad, CA with one specific goal – to help students just like you complete their assignments on time and get good grades!

Why do you do it?

Because getting a degree is hard these days! With many students being forced to juggle between demanding careers, family life and a rigorous academic schedule. Having a helping hand from time to time goes a long way in making sure you get to the finish line with your sanity intact!

How does it work?

You have an assignment you need help with. Instead of struggling on this alone, you give us your assignment instructions, we select a team of 2 writers to work on your paper, after it’s done we send it to you via email.

What kind of writer will work on my paper?

Our support team will assign your paper to a team of 2 writers with a background in your degree – For example, if you have a nursing paper we will select a team with a nursing background. The main writer will handle the research and writing part while the second writer will proof the paper for grammar, formatting & referencing mistakes if any.

Our team is comprised of native English speakers working exclusively from the United States. 

Will the paper be original?

Yes! It will be just as if you wrote the paper yourself! Completely original, written from your scratch following your specific instructions.

Is it free?

No, it’s a paid service. You pay for someone to work on your assignment for you.

Is it legit? Can I trust you?

Completely legit, backed by an iron-clad money back guarantee. We’ve been doing this since 2007 – helping students like you get through college.

Will you deliver it on time?

Absolutely! We understand you have a really tight deadline and you need this delivered a few hours before your deadline so you can look at it before turning it in.

Can you get me a good grade? It’s my final project and I need a good grade.

Yes! We only pick projects where we are sure we’ll deliver good grades.

What do you need to get started on my paper?

* The full assignment instructions as they appear on your school account.

* If a Grading Rubric is present, make sure to attach it.

* Include any special announcements or emails you might have gotten from your Professor pertaining to this assignment.

* Any templates or additional files required to complete the assignment.

How do I place an order?

You can do so through our custom order page here or you can talk to our live chat team and they’ll guide you on how to do this.

How will I receive my paper?

We will send it to your email. Please make sure to provide us with your best email – we’ll be using this to communicate to you throughout the whole process.

Getting Your Paper Today is as Simple as ABC

No more missed deadlines! No more late points deductions!

}

You give us your assignments instructions via email or through our order page.

Our support team selects a qualified writing team of 2 writers for you.

l

In under 5 minutes after you place your order, research & writing begins.

Complete paper is delivered to your email before your deadline is up.

Want A Good Grade?

Get a professional writer who has worked on a similar assignment to do this paper for you