You can try with Java Generics. Set<E> customSet=new HashSet<E>();
That is a way you can use assign data type in run time.
public static void innerJoinHash(List<SportsMan> sportsMans, List<Sport> sportList) {
Set set = new HashSet();
if (sportsMans.size() < sportList.size()) {
set.addAll(sportsMans)
} else {
set.addAll(sportList);
}
}