public RandomListNode copyRandomList(RandomListNode head) {
        if (head == null) return null;

        Map<RandomListNode, RandomListNode> map = new HashMap<>();

        RandomListNode x = head;
        RandomListNode newhead = new RandomListNode(0);
        RandomListNode newheadHelper = newhead;

        while (x != null) {
            newheadHelper.next = new RandomListNode(x.label);
            map.put(x, newheadHelper.next);
            x = x.next;
            newheadHelper = newheadHelper.next;
        }

        newheadHelper = newhead.next;
        x = head;

        while (x != null) {
            if (x.random != null)
                newheadHelper.random = map.get(x.random);

            newheadHelper = newheadHelper.next;
            x = x.next;
        }

        return newhead.next;

    }
Two round iteration solution using hashmap to find copy pair of original node.
src/problems/hard/CopyListwithRandomPointer.java