Add a new element to the set. Does not add if there is an
equivalent already present. Returns true where an element
is added, false where it already exists (and was possibly
updated). This variation invokes the given retain function
when the key does not already exist. You would typically
use that to duplicate a char[], or whatever is required.
Add a new element to the set. Does not add if there is an equivalent already present. Returns true where an element is added, false where it already exists (and was possibly updated). This variation invokes the given retain function when the key does not already exist. You would typically use that to duplicate a char[], or whatever is required.
Time complexity: O(1) average; O(n) worst.