I need to remove duplicates from an ArrayList of String irrespective of cases. for eq:
List list = Lists.newArrayList("Luke","luke");// it's guava's method
list.stream().distinct();
distinct()
above wont do any help as it works on equals method which will return false. Is there any other way that can do something like:
list.stream().distinct((a,b)->a.equalsIgnoreCase(b)).collect(..);
Update:
It might be different from possible duplicate because the possible duplicate's answers do show how to use distinct()
with property using a map. But a map that contains "Luke" will not return true if added "luke" and hence those answers wont work for this problem.