A LinkedList contains a set of Integer[]. Each Integer[] in the list has 2 numbers.
Ex of the linked list:
Integer[]{1,2}, Integer[]{2,3}.....
Before adding another Integer[] to this LinkedList, I wanto check if another Integer[] with the same data already exists.
Ex: Object to add = Integer[] {2,3}. But this already exists in the LinkedList.
So I want to avoid adding this.
How to verify that object already exists? Is there an inbuild function that can be used? contains() didnt do the trick.
contains(...)on the list. If you went this route, then best to make the class immutable.Setand creating a class for your integer-pairs with correctequalsandhashcodemethods.Set<Point>>instead: no duplicates as.equalsokay andaddthen returns false.