singly linked list - "Cannot find symbol - method add" error with LinkedList -


i'm trying use add method add elements linkedlist. code looks like:

       /**  * singly linked list.  *   * @author   * @version  */ public class linkedlist<t> {      private listelement<t> first;   // first element in list.     private listelement<t> last;    // last element in list.     public linkedlist<t> asd;     private int size;               // number of elements in list.      /**      * list element.      */     private static class listelement<t> {         public t data;         public listelement<t> next;          public listelement(t data) {             this.data = data;             this.next = null;         }     }      /**      * test method returns true if following invariants hold:      * <ul>      *   <li> size equals number of list elements, </li>      *   <li> if size == 0, first == null , last == null, </li>      *   <li> if size > 0, first != null , last != null, </li>      *   <li> if size == 1, first == last, </li>      *   <li> last.next == null. </li>      * </ul>      */     public boolean ishealthy() {         return false;     }      /**      * creates empty list.      */     public linkedlist() {         asd = new linkedlist<t>();     }      /**      * inserts given element @ beginning of list.      */     public void addfirst(t element) {         asd.add(element);     }      /**      * inserts given element @ end of list.      */     public void addlast(t element) {     }      /**      * returns first element of list.      * returns <code>null</code> if list empty.      */     public t getfirst() {         // todo         return null;     }      /**      * returns last element of list.      * returns <code>null</code> if list empty.      */     public t getlast() {         return null;     }      /**      * returns element @ specified position in list.      * returns <code>null</code> if <code>index</code> out of bounds.      */     public t get(int index) {         return null;     }      /**      * removes , returns first element list.      * returns <code>null</code> if list empty.      */     public t removefirst() {         return null;     }      /**      * removes of elements list.      */     public void clear() {     }      /**      * returns number of elements in list.      */     public int size() {         return 0;     }      /**      * returns <code>true</code> if list contains no elements.      */     public boolean isempty() {         return false;     }      /**      * returns string representation of list. string      * representation consists of list of elements enclosed in      * square brackets ("[]"). adjacent elements separated      * characters ", " (comma , space). elements converted      * strings method tostring() inherited object.      */     public string tostring() {         return null;     } } 

the problem when try compile, generates "cannot find symbol - method add(t)" error message. can't see why wouldn't work, i'm new java i'd on this.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -