Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void merge(Node secondList) {
- if (first == null)
- return;
- if (secondList.first == null)
- return;
- Node thisNodeReference = this.first;
- Node secondNodeReference = secondList.first;
- Node thisNextNodeReference, secondNextNodeReference;
- while (thisNodeReference != null && secondNodeReference != null) {
- thisNextNodeReference = thisNodeReference.next;
- secondNextNodeReference = secondNodeReference.next;
- thisNodeReference.next = secondNextNodeReference;
- thisNodeReference = thisNodeReference.next;
- thisNodeReference.next = thisNextNodeReference;
- thisNodeReference = thisNextNodeReference;
- secondNodeReference = secondNextNodeReference;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement