I am wondering if a java lambda function is always unique? If it is, what makes it unique?
In this pseudo code I have two Consumer with the some code but are not equals and hashCodes are differents too.
Consumer<String> c1 = s -> {
System.out.println(s);
};
Consumer<String> c2 = s -> {
System.out.println(s);
};
System.out.println(c1.hashCode());
System.out.println(c2.hashCode());
System.out.println(c1.equals(c2)); // false: is it always false?
I want to store a list of lambda in a Set, and I am not sure if I will not lose some elements if by accident I got two lambda functions with equal hashCodes.