mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 04:18:53 +01:00
Remove unnecessary unmodifiable collection wrappers.
This commit is contained in:
@@ -9,7 +9,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.logging.Logger;
|
||||
@@ -114,7 +113,7 @@ implements RemovableDriveMonitor.Callback {
|
||||
} catch (IOException e) {
|
||||
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
return Collections.unmodifiableList(matches);
|
||||
return matches;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.briarproject.plugins.file;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
@@ -13,8 +12,9 @@ abstract class UnixRemovableDriveFinder implements RemovableDriveFinder {
|
||||
protected abstract String parseMountPoint(String line);
|
||||
protected abstract boolean isRemovableDriveMountPoint(String path);
|
||||
|
||||
@Override
|
||||
public List<File> findRemovableDrives() throws IOException {
|
||||
List<File> drives = new ArrayList<File>();
|
||||
List<File> drives = new ArrayList<>();
|
||||
Process p = new ProcessBuilder(getMountCommand()).start();
|
||||
Scanner s = new Scanner(p.getInputStream(), "UTF-8");
|
||||
try {
|
||||
@@ -35,6 +35,6 @@ abstract class UnixRemovableDriveFinder implements RemovableDriveFinder {
|
||||
} finally {
|
||||
s.close();
|
||||
}
|
||||
return Collections.unmodifiableList(drives);
|
||||
return drives;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
package org.briarproject.plugins.file;
|
||||
|
||||
import com.sun.jna.platform.win32.Kernel32;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.platform.win32.Kernel32;
|
||||
|
||||
class WindowsRemovableDriveFinder implements RemovableDriveFinder {
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa364939.aspx
|
||||
private static final int DRIVE_REMOVABLE = 2;
|
||||
|
||||
@Override
|
||||
public Collection<File> findRemovableDrives() throws IOException {
|
||||
File[] roots = File.listRoots();
|
||||
if (roots == null) throw new IOException();
|
||||
List<File> drives = new ArrayList<File>();
|
||||
List<File> drives = new ArrayList<>();
|
||||
for (File root : roots) {
|
||||
try {
|
||||
int type = Kernel32.INSTANCE.GetDriveType(root.getPath());
|
||||
@@ -26,6 +26,6 @@ class WindowsRemovableDriveFinder implements RemovableDriveFinder {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableList(drives);
|
||||
return drives;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user