Use removeIf instead of doing this manually
This commit is contained in:
@@ -275,13 +275,7 @@ public class PlayQueueService {
|
||||
}
|
||||
|
||||
// Remove non-present files
|
||||
Iterator<MediaFile> iterator = files.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
MediaFile file = iterator.next();
|
||||
if (!file.isPresent()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
files.removeIf(file -> !file.isPresent());
|
||||
Player player = getCurrentPlayer(request, response);
|
||||
return doPlay(request, player, files).setStartPlayerAt(0);
|
||||
}
|
||||
|
||||
@@ -356,13 +356,7 @@ public class MediaFileService {
|
||||
* Removes video files from the given list.
|
||||
*/
|
||||
public void removeVideoFiles(List<MediaFile> files) {
|
||||
Iterator<MediaFile> iterator = files.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
MediaFile file = iterator.next();
|
||||
if (file.isVideo()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
files.removeIf(MediaFile::isVideo);
|
||||
}
|
||||
|
||||
public Date getMediaFileStarredDate(int id, String username) {
|
||||
|
||||
@@ -131,13 +131,7 @@ public class StatusService {
|
||||
}
|
||||
|
||||
public synchronized void addRemotePlay(PlayStatus playStatus) {
|
||||
Iterator<PlayStatus> iterator = remotePlays.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
PlayStatus rp = iterator.next();
|
||||
if (rp.isExpired()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
remotePlays.removeIf(PlayStatus::isExpired);
|
||||
remotePlays.add(playStatus);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,12 +65,6 @@ public class SpringLiquibase extends liquibase.integration.spring.SpringLiquibas
|
||||
}
|
||||
|
||||
private void removeCurrentHsqlDb(List<Database> implementedDatabases) {
|
||||
Iterator<Database> iterator = implementedDatabases.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Database db = iterator.next();
|
||||
if (db instanceof liquibase.database.core.HsqlDatabase) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
implementedDatabases.removeIf(db -> db instanceof liquibase.database.core.HsqlDatabase);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user