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;

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)

wow that was dumb! haha thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.