following is the scenario that I am encountering
I have this set of string here
Set<String> attributes = new LinkedHashSet<>();
yet I have another function with a signature LinkedHashSet
public static List<String> rerankAttributesByType (LinkedHashSet<String> attributeList)
is it safe for me to just cast attributes to LinkedHashSet and proceed with the function calls?
List<String> newAttributes = rerankAttributesByType((LinkedHashSet<String>) unselectedAttribute)
This is technically safe, since you know the actual concrete type, but not good practice.
Instead, change
to
so you don't have to do a cast, and you can properly use the interface type throughout your program.