Designing an append() method that would concatenate a second queue onto the calling queue in Java. The method needed to traverse the appended queue’s nodes instead of dequeueing its items.
My solution at the time involved iterating until the node that was currently being checked had a null pointer and then transferring the node contents one more time after my while loop condition was met (since the node with the null pointer never got read/appended), but I could’ve iterated through by using the size() method at the start and iterating while i < [variable storing size()]
package jv.test;
import static java.lang.System.out;
import java.util.*;
import java.util.stream.*;