954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to compare two sets of singly linked list

I need to know how to create methods to compare two sets of singly linked lists. The only problem is that I can't put a linkedlist inside the method parameters. Please help

import java.util.*;

public class SLinkedList {
  protected Node head; // head node of the list
  protected Node tail;
  protected int size; // number of nodes in the list
  /** Default constructor that creates an empty list */
  public SLinkedList() {
      head = new Node(null, null); // create a dummy head
      
      size = 0;
  }
 public boolean(SLinkedList obj){//tells me identifier is expected
      return true;
  }
Gsterminator
Light Poster
31 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 
public boolean(SLinkedList obj)


You have missed the method name here, that why it throws and error as identifier expectd... Give a method name like

public boolean methodName(SLinkedList obj)
Zaad
Junior Poster in Training
71 posts since Aug 2009
Reputation Points: 2
Solved Threads: 11
 

wow that was dumb! haha thanks

Gsterminator
Light Poster
31 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: