public static JalviewFileChooser forRead(String directory,
String selected)
{
- List<String> extensions = new ArrayList<String>();
- List<String> descs = new ArrayList<String>();
+ List<String> extensions = new ArrayList<>();
+ List<String> descs = new ArrayList<>();
for (FileFormatI format : FileFormats.getInstance().getFormats())
{
if (format.isReadable())
{
// TODO in Java 8, forRead and forWrite can be a single method
// with a lambda expression parameter for isReadable/isWritable
- List<String> extensions = new ArrayList<String>();
- List<String> descs = new ArrayList<String>();
+ List<String> extensions = new ArrayList<>();
+ List<String> descs = new ArrayList<>();
for (FileFormatI format : FileFormats.getInstance().getFormats())
{
if (format.isWritable())
super(safePath(dir));
if (extensions.length == descs.length)
{
- List<String[]> formats = new ArrayList<String[]>();
+ List<String[]> formats = new ArrayList<>();
for (int i = 0; i < extensions.length; i++)
{
formats.add(new String[] { extensions[i], descs[i] });
private void loadExtensions()
{
- extensions = new HashMap<String, String>();
+ extensions = new HashMap<>();
for (FileFormatI ff : FileFormats.getInstance().getFormats())
{
String desc = ff.getName() + " file";
String exts = ff.getExtensions();
for (String ext : exts.split(","))
{
- extensions.put(ext.trim().toLowerCase(),
+ ext = ext.trim().toLowerCase();
+ extensions.put(ext,
desc + ("jar".equals(ext) ? " (old)" : ""));
}
}
{
if (icons == null)
{
- icons = new HashMap<String, ImageIcon>();
+ icons = new HashMap<>();
}
if (!icons.containsKey(filePath))
{