equals Method
The document is archived and information here might be outdated

List.equals Method

Visual Studio 2005

Checks if a List object is equal to the specified object.

Package: java.util

Assembly: vjslib (in vjslib.dll)

public abstract boolean equals(
    java.lang.Object c);



The object to compare to.

true if the specified object is equal to this object; false otherwise.

In this example, you create two linked list objects, add some elements to the first one, and copy it to the second one. Then you test the two objects for equality.

// list-eq1.jsl
// List.Equals example

import java.util.*;

public class MyClass
    public static void main(String[] args)
        // Create a linked list object:
        LinkedList lList =  new LinkedList();

        // Add some elements:
        lList.add("My Node");
        lList.add("Your Node");
        lList.add(new Integer(55));

        // Create a new list lList1:
        LinkedList lList1 =  new LinkedList();

        // Add all the element of lList to lList1:

        // Check if the two lists are identical:
            System.out.println("The two lists are the same.");

The two lists are the same.
© 2016 Microsoft