Question: A popular implementation of List is ArrayList. Look up how to instantiate one. * * @return a List object. */ public List createList(){ } return

A popular implementation of List is ArrayList. Look up how to instantiate one.

*

* @return a List object.

*/

public List createList(){

}

return null;

}

/**

* Get the size of a list.

*

* @param list a List object.

* @return the size of List (number of items it holds.)

*/

return 0;

}

/**

* Add an item to a list.

* When we add a value to a list, it gets appended to the end.

*

* @param list a List object that we would like to modify.

* @param value an integer that we would like to add to list.

* @return nothing, pass by reference will cause changes to the list object to be reflected across the program.

*/

public void addToList(List list, int value){

}

/**

* Get a particular index of a list.

* Lists, like arrays, are zero-indexed, so they start counting at zero. For instance,

* index 0 of {0,2,4,6} is 0.

* index 1 of {0,2,4,6} is 2.

* Index is the same as saying the position, number, etc of a value.

* Let's get the element from a list at a certain index.

*

* @param list a List object that we would like to examine.

* @param index represents the index of the element we would like to retrieve.

* @return the int at the location in 'list' represented by 'index'.

*/

public int get(List list, int index){

return 0;

}

/**

* Remove an index from a list.

* We can remove an item from the list, which will cause all items after it to reduce their index by 1 (they are

* all still ordered, without any empty spaces in the list.)

*

* @param list a List object that we would like to modify.

* @param position represents the index of the element we would like to remove.

* @return nothing, pass by reference will cause changes to the list object to be reflected across the program.

*/

public void removeFromList(List list, int position){

}

/**

* Update an index of a list.

* We can update a value in the list, which will overwrite a value at a certain position.

*

* @param list a List object that we would like to modify.

* @param position represents the index of the element we would like to change.

* @param value the new value which we would like to assign to the item at position in list

* @return nothing, pass by reference will cause changes to the list object to be reflected across the program.

*/

public void updateAtPosition(List list, int position, int value){

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!