From af0d8c7f5c258e7a6b4d2e9bf839958464d362c6 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 8 Jul 2014 14:32:29 +0200 Subject: [PATCH] Let Sketch.getExtensions() return a List This simplifies upcoming changes. --- app/src/processing/app/Sketch.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 4b2c6b44b..35109ab80 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -170,7 +170,7 @@ public class Sketch { code = new SketchCode[list.length]; - String[] extensions = getExtensions(); + List extensions = getExtensions(); for (String filename : list) { // Ignoring the dot prefix files is especially important to avoid files @@ -1849,11 +1849,7 @@ public class Sketch { * extensions. */ public boolean validExtension(String what) { - String[] ext = getExtensions(); - for (int i = 0; i < ext.length; i++) { - if (ext[i].equals(what)) return true; - } - return false; + return getExtensions().contains(what); } @@ -1873,8 +1869,8 @@ public class Sketch { /** * Returns a String[] array of proper extensions. */ - public String[] getExtensions() { - return new String[] { "ino", "pde", "c", "cpp", "h" }; + public List getExtensions() { + return Arrays.asList("ino", "pde", "c", "cpp", "h"); }