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
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

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

    Duplicate of http://www.javaprogrammingforums.com...2-errors*.html
    Thread locked

  3. The Following User Says Thank You to copeg For This Useful Post:

    Eriosblood (November 5th, 2012)

Similar Threads

  1. 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
  2. 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
  3. Linked List Help
    By BuhRock in forum Collections and Generics
    Replies: 3
    Last Post: September 26th, 2011, 08:43 AM
  4. linked list help
    By tjoney in forum What's Wrong With My Code?
    Replies: 6
    Last Post: March 3rd, 2011, 06:54 PM
  5. Help with linked list
    By joecool594 in forum Collections and Generics
    Replies: 3
    Last Post: November 28th, 2010, 12:33 PM