Respuesta :

Answer:

The complete method is as follows:

public List buildList(List L) {  

 L.insert(30);

 L.insert(23);

 L.insert(19);

 L.insert(4);  

   return L; }

Explanation:

To complete the method, we make use of the insert() function.

This inserts elements of the list into list L. However, we have to start from the last element (i.e. in descending order)

So, the explanation is as follows:

 

 L.insert(30); --- This inserts the last element

Continue inserting in descending order

 L.insert(23);  

 L.insert(19);

Until the first list element is inserted

 L.insert(4);

This returns the filled list L  

   return L;

A class of ArrayList is a redimensionable array in java. During built-in arrays, ArrayLists can dynamically change their size. Elements can be added and removed from an ArrayList when necessary, which helps the user handle this same memory, and the method described can be defined as follows:

Method code:

public List buildList(List L)//defining a method buildList that takes List variable L in parameter

{

L.insert("30");//Calling insert method that takes a value in parameter.

L.insert("23");//Calling insert method that takes a value in parameter.

L.insert("19");//Calling insert method that takes a value in parameter.

L.insert("4");//Calling insert method that takes a value in parameter.

L.next();//calling next method that prints list value

L.next();//calling next method that prints list value

   return L;//return list value L

}

Method Description:

  • In this code, a  List type of method "buildList" is declared that accepts the List type of variable L in parameter.
  • Inside the method, an insert method is declared that accepts an integer variable in its parameter.
  • In the next step, the next method is called which is used the ListIters interface method, the next item is returned in the list given.
  • At the last, it uses the return keyword that returns the list value "L".

Learn more:

brainly.com/question/2901618