Fixes a bug in the getMatching method causing the input list to lose all matching elements
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good

This commit is contained in:
Kristian Knarvik 2020-05-09 01:50:42 +02:00
parent f4afb63f32
commit 7f479fd760
2 changed files with 6 additions and 5 deletions

View File

@ -13,19 +13,19 @@ import java.util.List;
* A converter for converting audio files
*/
public class AudioConverter extends AbstractConverter {
private final String newExt;
private final String newExtension;
/**
* Instantiates a new audio converter
*
* @param ffprobePath <p>Path/command to ffprobe.</p>
* @param ffmpegPath <p>Path/command to ffmpeg.</p>
* @param newExt <p>The extension of the new file.</p>
* @param newExtension <p>The extension of the new file.</p>
*/
public AudioConverter(String ffprobePath, String ffmpegPath, String newExt) {
public AudioConverter(String ffprobePath, String ffmpegPath, String newExtension) {
this.ffprobePath = ffprobePath;
this.ffmpegPath = ffmpegPath;
this.newExt = newExt;
this.newExtension = newExtension;
}
/**
@ -76,6 +76,6 @@ public class AudioConverter extends AbstractConverter {
@Override
public void convert(File file) throws IOException {
processFile(file.getParentFile(), file, newExt);
processFile(file.getParentFile(), file, newExtension);
}
}

View File

@ -40,6 +40,7 @@ public final class ListUtil {
* @return <p>A new list containing all matching elements.</p>
*/
static <T> List<T> getMatching(List<T> list, Predicate<T> predicate) {
list = new ArrayList<>(list);
List<T> copy = new ArrayList<>(list);
list.removeIf(predicate);
copy.removeAll(list);