Lets say you have array arr1 = {2,3,4,null,null,null,null} and..
arr2 = {6,7,8}
What I want to do is to add the arr2 to arr1 on top of the stack so that after the addAll method arr1 would look like..
arr1 = {2,3,4,6,7,8,null} and arr2 would be empty. I know using an arrayList would more than likely be easier but I am trying to understand the logic of using multiple for loops to iterate through both arrays. The method looks like this.
public Bag addAll(Bag b1);
The Bag is a class with a constructor:
Any help would be greatly appreciated!
arr2 = {6,7,8}
What I want to do is to add the arr2 to arr1 on top of the stack so that after the addAll method arr1 would look like..
arr1 = {2,3,4,6,7,8,null} and arr2 would be empty. I know using an arrayList would more than likely be easier but I am trying to understand the logic of using multiple for loops to iterate through both arrays. The method looks like this.
public Bag addAll(Bag b1);
The Bag is a class with a constructor:
Bag(int size){ counter = 0; count_ItemsRemoved = 0; count_ItemsRandomlyRemoved = 0; collect = new Object[size]; }
Any help would be greatly appreciated!