<commit_before>// LinkedList
// Source: http://goo.gl/ysg92v

import Foundation

// Double LinkedList structure
class LLNode<T> {
    var key: T?
    var next: LLNode?
    var previous: LLNode?
}

public class LinkedList<T: Equatable>{

    // create a new LLNode instance
    private var head: LLNode<T> = LLNode<T>()
    
    // The number of linked items
    var count: Int{
        get{
            return 0
        }
    }
    
    // Append a new item to a linked list
    func addLink(key:T){
        // establish the head node
        if (head.key == nil) {
            head.key = key
            return;
        }
        
        // establish the iteration variables
        var current: LLNode? = head
        
        while (current != nil) {
            if (current?.next == nil) {
                
                var childToUse: LLNode = LLNode<T>()
                
                childToUse.key = key
                childToUse.previous = current
                current!.next = childToUse
                break;
            }
            
            current = current?.next
        }<commit_msg>Counting the number of elements in the list<commit_after>// LinkedList
// Source: http://goo.gl/ysg92v

import Foundation

// Double LinkedList structure
class LLNode<T> {
    var key: T?
    var next: LLNode?
    var previous: LLNode?
}

public class LinkedList<T: Equatable>{

    // create a new LLNode instance
    private var head: LLNode<T> = LLNode<T>()
    
    // The number of linked items
    var count: Int{
        get{
            if (head.key == nil) {
                return 0
            }else{
                var current: LLNode = head
                var result: Int = 1
                
                while ((current.next) != nil) {
                    current = current.next!
                    result++
                }
                return result
            }
        }
    }
    
    // Append a new item to a linked list
    func addLink(key:T){
        // establish the head node
        if (head.key == nil) {
            head.key = key
            return;
        }
        
        // establish the iteration variables
        var current: LLNode? = head
        
        while (current != nil) {
            if (current?.next == nil) {
                
                var childToUse: LLNode = LLNode<T>()
                
                childToUse.key = key
                childToUse.previous = current
                current!.next = childToUse
                break;
            }
            
            current = current?.next
        }
{'fraction_non_alphanumeric': 0.08740854832499037, 'fraction_numerical': 0.0026954177897574125, 'mean_word_length': 1.1740585774058578, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '2267201', 'n_tokens_mistral': 705, 'n_tokens_neox': 678, 'n_words': 211}