<commit_before>/**
 * A collection of linked list related problems
 */
public class LinkedListProblems {

    private static class Node {
        int value;
        Node next;

        public Node(int value) {
            this.value = value;
        }
    }
    
    public static void main(String[] args) {
        
        LinkedListProblems driver = new LinkedListProblems();
        Node head = new Node(1);
        Node tmpHead = head;
        for (int i = 2; i <= 20; i++) {
            Node newNode = new Node(i);
            tmpHead.next = newNode;
            tmpHead = tmpHead.next;
        }

        printLinkedList(driver.iterativeReversal(head));
    }

    public static void printLinkedList(Node head) {
        Node tmpNode = head;
        while (tmpNode != null) {
            System.out.println(tmpNode.value);
            tmpNode = tmpNode.next;
        }
    }

    public Node iterativeReversal(Node head) {
        Node current = head;
        Node prev = null;
        
        while (current != null) {
            Node next = current.next;
            current.next = prev;
            prev = current;
            current = next;
        }
        
        return prev;
    }

}<commit_msg>+1 LinkedList<commit_after>/**
 * A collection of linked list related problems
 */
public class LinkedListProblems {

    private static class Node {
        int value;
        Node next;

        public Node(int value) {
            this.value = value;
        }
    }
    
    public static void main(String[] args) {
        
        LinkedListProblems driver = new LinkedListProblems();
        Node head = new Node(1);
        Node tmpHead = head;
        for (int i = 2; i <= 20; i++) {
            Node newNode = new Node(i);
            tmpHead.next = newNode;
            tmpHead = tmpHead.next;
        }

        tmpHead.next = new Node(19);
        tmpHead = tmpHead.next;
        tmpHead.next = new Node(19);

        //printLinkedList(driver.iterativeReversal(head));
        System.out.println("==========================");
        printLinkedList(head);
        System.out.println("==========================");
        printLinkedList(removeAll(head, 19));
    }


    /**
     * Remove all occurrences of val and return head
     */
    public static Node removeAll(Node head, int value) {
        if (head == null) {
            return head;
        }

        Node curr = head;
        Node prev = null;

        while (curr != null) {
            if (curr.value == value) {
                if (curr == head) {
                    head = head.next;
                    curr = head;
                } else {
                    prev.next = curr.next;
                    curr = curr.next;
                }
            } else {
                prev = curr;
                curr = curr.next;
            }
        }

        return head;
    }

    public static void printLinkedList(Node head) {
        Node tmpNode = head;
        while (tmpNode != null) {
            System.out.println(tmpNode.value);
            tmpNode = tmpNode.next;
        }
    }

    public Node iterativeReversal(Node head) {
        Node current = head;
        Node prev = null;
        
        while (current != null) {
            Node next = current.next;
            current.next = prev;
            prev = current;
            current = next;
        }
        
        return prev;
    }

}
{'fraction_non_alphanumeric': 0.11013473930872876, 'fraction_numerical': 0.004393673110720563, 'mean_word_length': 1.399859451862263, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '357942', 'n_tokens_mistral': 950, 'n_tokens_neox': 900, 'n_words': 253}