In: Computer Science
To improve the overall functionality and efficiency of your sub-ordering Java application, you are considering the use of some of the Java predefined methods. Some of the predefined Java classes and methods you are evaluating include vectors, wrapper classes, conversion methods, and collections data structures to process lists. Within the Discussion Board area, write 5 paragraphs that respond to the following questions with your thoughts, ideas, and comments. This will be the foundation for future discussions by your classmates. Be substantive and clear, and use examples to reinforce your ideas:
Thoroughly describe how you would utilize each of the following 4 topic areas to enhance the implementation of your Java sub-ordering application:
Vector class and methods (in terms of queue and stack creation and manipulation)
Wrapper classes (primitive)
Conversion methods (various string conversions)
Collections data structures (to build link list, queue, stack, search, and sort)
Dear Student, I have spent lot of time to make these terms short and clean, so if you got something from it, then give it an upvote. Thank you.
Q1) Vector class and methods
Ans: Vector is like the dynamic array which can grow or shrink its size. Unlike array, we can store n-number of elements in it as there is no size limit.
Java Vector class Declaration
public class Vector<E>
extends AbstractList<E>
implements List<E>, RandomAccess, Cloneable, Serializable
The Vector class implements a growable array of objects. Like an array, it contains components that can be accessed using an integer index. However, the size of a Vector can grow or shrink as needed to accommodate adding and removing items after the Vector has been created.
* The underlying structure for a stack could be an array, a vector, an ArrayList, a linked list, or any other collection. Regardless of the type of the underlying data structure, a Stack must implement the same functionality.
* It is very common to use a one-dimensional array as the representattion of a stack (vector representation) --> the item at the bottom of the stack is stored in the first array element, the stack item second to the bottom is stored in the second array element, etc.
* It is very common to use a one-dimensional array as the representattion of a queue (vector representation), the major shortcoming of the vector implementation is that queues must be limited in size. An alternative that eliminates this restriction is representing a queue as a linked list.
Q2) Wrapper classes
Ans: Wrapper classes provide a way to use primitive data types like int, boolean, Float, etc as objects.
When we create an object to a wrapper class, it contains a field and in this field, we can store primitive data types. In other words, we can wrap a primitive value into a wrapper class object.
To enhance the implementation of your Java code can be made easy by wrapper class, which deals with serialization, synchronization which includes collection framework like ArrayList, LinkedList, Vector, etc.
Q3) Conversion methods (various string conversions)
Ans: Conversion method in which string conversions are very important in java to enhance the implementation of Java application.
Various string conversions include:
1. Convert using Integer.toString(int)
The Integer class has a static method that returns a String
object.
2. Convert using String.valueOf(int)
3. Convert using Integer(int).toString()
This methods used to invoke it’s toString method.
4.Convert using DecimalFormat
It is a class that formats a number to a String.
5. Convert using StringBuffer or StringBuilder
it is used to concatenate multiple values into a String.
6. Convert with special radix
Q4) Collections data structures (to build link list, queue, stack, search, and sort)
Ans: A Collection represents a single unit of objects like group
here the list Interface extends the collection framework which is a child interface of the collection interface. This interface is dedicated to the data of the list type in which we can store all the ordered collection of the objects. This is a child interface of the collection interface. This interface is dedicated to the data of the list type in which we can store all the ordered collection of the objects.
syntax:
List <data-type> list1= new ArrayList();
List <data-type> list2 = new LinkedList();
List <data-type> list3 = new Vector();
List <data-type> list4 = new Stack();
here stacks and queues are special cases of the idea of a collection.