The following Java code:
public static void main(String args[]) {
    int[] x = new int[] {1, 2, 3};
    int[] y = new int[] {1, 2, 3};
    LinkedList<int[]> list = new LinkedList<int[]>();
    list.add(x);
    System.out.println("List contains y: " + list.contains(y));
}
gives the output
    List contains y: false
which makes sense as x and y are references to different memory locations, however there is also a sense in which they are equal (they have the the same elements in the same order).
Is there a data structure which would return true to the query list.contains(y) in this example?
 
     
     
     
     
     
     
    