I'm learning Java and I have come across one tutorial about Hash Maps and start typing the same code like my tutor. The problem is when I came across String.join method, I got an error and my tutor didn't, and I do not know why.
This is the error:
The method join(String, List<String>) is undefined for the
type String
Can you tell me whats the problem?
private String getZnanjaList(){
List <String> listaZnanja = new ArrayList<>();
for (String znanje : this.znanja.keySet()){
listaZnanja.add(znanje + ": " + this.znanja.get(znanje));
}
return String.join("; ", listaZnanja);
}