It depends of which view you have opened.
If it is in the
Project Explorer
view, there is no way to collapse the list.But it is possible to hide the libraries. In the
Customize View
dialog, uncheckLibraries from external
:If it is in the
Package Explorer
view (which is a better view for Java/Scala projects), there is an option to collapse the referenced libraries, which is enabled by default: