Skip to content

Commit 8e1e745

Browse files
Let Sketch.getExtensions() return a List
This simplifies upcoming changes.
1 parent 82db86d commit 8e1e745

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

app/src/processing/app/Sketch.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ protected void load() throws IOException {
170170

171171
code = new SketchCode[list.length];
172172

173-
String[] extensions = getExtensions();
173+
List<String> extensions = getExtensions();
174174

175175
for (String filename : list) {
176176
// Ignoring the dot prefix files is especially important to avoid files
@@ -1850,11 +1850,7 @@ public boolean isDefaultExtension(String what) {
18501850
* extensions.
18511851
*/
18521852
public boolean validExtension(String what) {
1853-
String[] ext = getExtensions();
1854-
for (int i = 0; i < ext.length; i++) {
1855-
if (ext[i].equals(what)) return true;
1856-
}
1857-
return false;
1853+
return getExtensions().contains(what);
18581854
}
18591855

18601856

@@ -1874,8 +1870,8 @@ public List<String> getHiddenExtensions() {
18741870
/**
18751871
* Returns a String[] array of proper extensions.
18761872
*/
1877-
public String[] getExtensions() {
1878-
return new String[] { "ino", "pde", "c", "cpp", "h" };
1873+
public List<String> getExtensions() {
1874+
return Arrays.asList("ino", "pde", "c", "cpp", "h");
18791875
}
18801876

18811877

0 commit comments

Comments
 (0)