<commit_before>package LinkedList;

/**
 * Linkedlist implementation
 */
public class LinkedList {
    // holds reference to the head
    Node head;

    private static class Node {
        // each hode has data and pointer to the next
        int data;
        Node next;
        Node(int data){ //constructor
            this.data = data;
            next = null;
        }
    }
}<commit_msg>Simple linked list impl<commit_after>package LinkedList;

/**
 * Linkedlist implementation
 */
public class LinkedList {
    // holds reference to the head
    private Node head;
    private int listCount;

    public LinkedList() {
        head = null;
        listCount = 0;
    }

    private class Node {
        // each hode has data and pointer to the next
        int data;
        Node next;
        Node(int data){ //constructor
            this.data = data;
            next = null;
        }
    }

    // O(1)
    public void addFirst(int data){
        Node newNode = new Node(data);
        newNode.next = head;
        head = newNode;
        listCount++;
    }

    // O(n)
    // Optimization keep pointer to tail for O(1)
    public void addLast(int data){
        Node newNode = new Node(data);
        if(head == null){
            head = newNode;
            return;
        }
        newNode.next = null;

        Node temp = head;
        while(temp.next != null){
            temp = temp.next;
        }
        temp.next = newNode;
        listCount++;
    }

    public void addAfter(){

    }

    public void remove(){

    }

    public int size(){
        return listCount;
    }

    public void printList(){
        Node temp = head;
        while(temp != null){
            System.out.print(temp.data + " ");
            temp = temp.next;
        }
        System.out.println();
    }

    public static void main(String[] args) {
        LinkedList list = new LinkedList();
        list.addFirst(1);
        list.addFirst(2);
        list.addFirst(3);
        list.addLast(0);

        list.printList();
        System.out.println(list.size());
    }
}
{'fraction_non_alphanumeric': 0.10523786641037962, 'fraction_numerical': 0.003363767419509851, 'mean_word_length': 1.5672009864364982, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2205857', 'n_tokens_mistral': 595, 'n_tokens_neox': 578, 'n_words': 173}