CustomLibraryDescription (List<? extends FrameworkVersion> versions) { String defaultLibraryName = null; List<FrameworkVersion> withLibraries = new ArrayList<>(); for (FrameworkVersion version : versions) { if (version.getLibraries().length > 0) { if (version.isDefault()) { defaultLibraryName = version.getLibraryName(); } withLibraries.add(version); } } if (withLibraries.isEmpty()) return null; if (defaultLibraryName == null) { defaultLibraryName = withLibraries.get(0).getLibraryName(); } return new OldCustomLibraryDescription(withLibraries, defaultLibraryName); }