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