In my Java application i need to compare two list's element whether it is similar or not.
In short suppose i have two list declared like shown below
List<String> a = new ArrayList<String>();
a.add("one");
a.add("three");
a.add("two");
Collections.sort(a);
List<String> a1 = new ArrayList<String>();
a1.add("ONE");
a1.add("two");
a1.add("THREE");
Collections.sort(a);
If i write a condition for equality it fails as some of list's element is in different case like
if(a.equals(a1)){
System.out.println("equal");
} else{
System.out.println("not equal");
}
It will display result "Not equal"
So please tell me how i can make the list element case-insensitive in Java language only.
Thank and regard