try to write linked list
i am trying to write linked list and have some problems:

this is intNode class:

    public class IntNode
    {
        private int _value;
        private IntNode _next;
    
        public IntNode(int v, IntNode n)
        {
            _value = v;
            _next = n;
    
        }
        public int getValue()
        {
            return _value;
        }
    
        public IntNode getNext()
        {
            return _next;
        }
    
        public void setValue(int v)
        {
            _value = v;
        }
    
        public void setNext(IntNode n)
        {
            _next = n;
        }
    }

my linked list class:

 

   public class Set
    {
        private IntNode _head;
        private IntNode _current;
        private IntNode _lastNode;

        /**
         * create a new empty Set object
         */
        public Set()
        {
            _head = null;
            _current = null;
            _lastNode = null;
        }

        /**
         * check if the object empty
         * @return true if Set object contain elements, false otherwise
         */
        public bool isEmpty()
        {
            return (_head == null);
        }

        /**
         * add number to Set object
         * @param x - the number to be add 
         */
        public void addToSet(int x)
        {
            if (isEmpty())
            {
                _head = new IntNode(x, _current);
                _head.setNext(_current);
            }
            else
            {
                _current = new IntNode(x, _lastNode);
                _current.setNext(_lastNode);
            }
        }

        /**
         * return a string representation of this Set 
         */
        public String toString()
        {
            String temp = "";

            for (IntNode currentNode = _head; currentNode != null; currentNode.getNext())
            {
                temp += currentNode.getValue() + ",";
            }

            return temp;
        }

i have problem with my addToSet and toString methods and i cannot find it.
try to write linked list
===

i am trying to write linked list and have some problems:

this is intNode class:

    public class IntNode
    {
        private int _value;
        private IntNode _next;
    
        public IntNode(int v, IntNode n)
        {
            _value = v;
            _next = n;
    
        }
        public int getValue()
        {
            return _value;
        }
    
        public IntNode getNext()
        {
            return _next;
        }
    
        public void setValue(int v)
        {
            _value = v;
        }
    
        public void setNext(IntNode n)
        {
            _next = n;
        }
    }

my linked list class:

 

   public class Set
    {
        private IntNode _head;
        private IntNode _current;
        private IntNode _lastNode;

        /**
         * create a new empty Set object
         */
        public Set()
        {
            _head = null;
            _current = null;
            _lastNode = null;
        }

        /**
         * check if the object empty
         * @return true if Set object contain elements, false otherwise
         */
        public bool isEmpty()
        {
            return (_head == null);
        }

        /**
         * add number to Set object
         * @param x - the number to be add 
         */
        public void addToSet(int x)
        {
            if (isEmpty())
            {
                _head = new IntNode(x, _current);
                _head.setNext(_current);
            }
            else
            {
                _current = new IntNode(x, _lastNode);
                _current.setNext(_lastNode);
            }
        }

        /**
         * return a string representation of this Set 
         */
        public String toString()
        {
            String temp = "";

            for (IntNode currentNode = _head; currentNode != null; currentNode.getNext())
            {
                temp += currentNode.getValue() + ",";
            }

            return temp;
        }

i have problem with my addToSet and toString methods and i cannot find it.