In [3]:
/*
 * Bryce Henley
 * CSC205AB
 * 10/26/2017
 *
 * Homework 8 linked list implementation
 *
 * Copyright (c) 2017 Bryce Henley
 * The MIT License
 *
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */


class Main {
    public static void main(String[] args){
        
    }
}
class Link {
    public Object data;
    public Link next;
}
class LinkedList {
    private Link _head;
    private LinkedList(){
        _head = null;
    }
    public void insert(Object item) {
        Link add = _head;
        add.data = item;
        _head = add;
    }
    public void delete(Object item) {
        if(head == null)
            return null;
        
        Link cursor = _head;
        Link prev = _null;
        
        boolean found = false;
        while(cursor.next != null && !found){ 
            if(!cursor.data.equals(item)) {
            prev = cursor;
            cursor = cursor.next;
            }else{
                found = true;
            }
        }
        if(cursor.next != null) {
            prev.next = cursor.next;
            cursor = null;
        }else {
            prev.next = null;
            cursor = null;
        }
    }
    public boolean test(Object item){
        if(head == null){
            return false;
        }
        Link cursor = _head;
        
        boolean found = false;
        
        while(cursor.next != null && !found){
            if(!cursor.data.equals(item)){
                cursor = cursor.next;
            }else{
                found = true;
            }
        }
        return found;
    }
    public String toString(){
        String result = "";
        Link cursor;
        cursor = _head;
        while(cursor != null){
            result = result + " " + cursor.data;
            cursor = cursor.next;
        }
        return result;
    }
}


Out[3]:
No Outputs