forked from processing/processing
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Opened access to Java 11 language features.
Moved from Java 8 to Java 11 for Compiler and JDT. Also added gramatical support for local variable type inference (var).
- Loading branch information
1 parent
8a502c7
commit 8e0bf4e
Showing
8 changed files
with
107 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import processing.core.*; | ||
import processing.data.*; | ||
import processing.event.*; | ||
import processing.opengl.*; | ||
|
||
import java.util.*; | ||
import java.util.function.*; | ||
|
||
import java.util.HashMap; | ||
import java.util.ArrayList; | ||
import java.io.File; | ||
import java.io.BufferedReader; | ||
import java.io.PrintWriter; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.io.IOException; | ||
|
||
public class typeinference extends PApplet { | ||
|
||
public void setup() { | ||
List<String> list = new ArrayList<>(); | ||
list.add("line1\nline2"); | ||
list.add("line3"); | ||
|
||
// Local variable type inference in loop | ||
for (var s : list) { | ||
println(s); | ||
} | ||
|
||
// Local variable type inference | ||
var testString = list.get(0); | ||
println(testString.lines().count()); // Java 11 API | ||
} | ||
|
||
|
||
static public void main(String[] passedArgs) { | ||
String[] appletArgs = new String[] { "typeinference" }; | ||
if (passedArgs != null) { | ||
PApplet.main(concat(appletArgs, passedArgs)); | ||
} else { | ||
PApplet.main(appletArgs); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import java.util.*; | ||
import java.util.function.*; | ||
|
||
void setup() { | ||
List<String> list = new ArrayList<>(); | ||
list.add("line1\nline2"); | ||
list.add("line3"); | ||
|
||
// Local variable type inference in loop | ||
for (var s : list) { | ||
println(s); | ||
} | ||
|
||
// Local variable type inference | ||
var testString = list.get(0); | ||
println(testString.lines().count()); // Java 11 API | ||
} |