Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Sequence with linked list and Generics *2 Errors*

  1. #1
    Member
    Join Date
    Sep 2012
    Posts
    35
    My Mood
    Lurking
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Sequence with linked list and Generics *2 Errors*

    Hello! Ran the J-unit tests, runs 19/19 with 2 Errors located in my methods: addAll & concatenation.
    I truly appreciate the help friends!

    public void addAll(LinkedSeq<E> addend)
    	   {
    		   if(addend == null)
    		   {
    			   throw new NullPointerException("addend is null");
    		   }
     
    		   ********tail.setLink(addend.head);********(Seems it originates here)
     
    		   //addend.head = this.tail;
    		   tail = addend.tail;
    		   //addend.tail = this.tail;
    		   addend.cursor = null;
    		   manyNodes += addend.manyNodes;
     
    		   addend.tail = tail; 
    		   //if(addend.tail.getLink() != null)
    		   //{
    			  // addend.tail = addend.tail.getLink();
    		   //}
    	   }

    And here's the second method

    public static <E> LinkedSeq<E> concatenation(LinkedSeq<E> s1, LinkedSeq<E> s2)
    	   {
    		   if((s1 == null) || (s2 == null))
    		   {
    			   throw new IllegalArgumentException ("concatenation:  one argument is null");
    		   }
     
    		   LinkedSeq<E> answer = new LinkedSeq<E>();
    	       ****************answer.addAll(s1);*****************(Other trace)
    	       answer.addAll(s2);
    	       return answer;
    	   }


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Sequence with linked list and Generics *2 Errors*

    Please post word for word errors with your question and your code.

Similar Threads

  1. Sequence with linked list and Generics *2 Errors*
    By Eriosblood in forum Object Oriented Programming
    Replies: 1
    Last Post: November 5th, 2012, 02:12 PM
  2. Help With Sequence Array, Current Index, 3 Errors, 6 Failures
    By Eriosblood in forum Object Oriented Programming
    Replies: 4
    Last Post: October 15th, 2012, 09:04 PM
  3. linked list
    By javasohard in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 18th, 2011, 02:22 AM
  4. Linked list Schminked list help with Nodes Please
    By Bially in forum Collections and Generics
    Replies: 1
    Last Post: September 29th, 2011, 03:20 PM
  5. Help with linked list
    By joecool594 in forum Collections and Generics
    Replies: 3
    Last Post: November 28th, 2010, 11:33 AM