Java Custom Arraylist Class Use Java Array List Api Use Array Algorithm Write Static Funct Q37223957

Java

In your own custom ArrayList<E> class(do not use JavaArray List API) use Array algorithm

Write a static function called RemoveNullElements() withoutcreating another array.

that remove Null elements and shift all the rest of the elementsto the left/front (small indexes) of the array without changing thesize or length of the original array( this meant the front of thearray will have all the not Null elements, and the other haft willbe empty/Null.

Please provide test code as well, thanks


Answer


import java.util.ArrayList;import java.util.Arrays;public class RemoveNullElementsTest { public static <E> void RemoveNullElements(ArrayList<E> list) { for (int

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.