Java introduced a new way to collect the result of a stream to a list like this
New way is list.stream().toList()
Old way is list.stream().collect(Collectors.toList())
When using the new way, sonarqube shows a warning that the result of the stream is not used, but it is
This is a known issue, it has been fixed in the Java analyzer version 7.1, available in SonarQube versions > 9.0. (see SONARJAVA-3784).
Note that many other new features and adjustments have been made related to Java 16/17, if you are using a recent Java version you should consider upgrading SonarQube.