Whiteboard results - Language change
Two whiteboards were dedicated to language changes, with 10 ideas considered. A short example of each change was given, with votes being taken. The question each time was "Do you support this language change?".
Property declaration
Remove the need to write getter/setters, and raise the conceptual level of applications:
public class Person {
public property String forename;
public property int age;
}
The vote results were:
Property access
Access properties using simple dot notation:
public class Person {
public property String forename;
public property int age;
}
Person p = new Person();
p.forename = "Stephen"; String str = p.forename;
The vote results were:
Improve generics
Remove some issues around generics:
public class MyClass {
public void process(List<String> list) {...}
public void process(List<Integer> list) {...}
}
if (list instanceof List<String> { ... }
The vote results were:
Access List and Map using []
Use the [] operator to access List and Map:
List<String> list = ...
String first = list[0];
Map<String, Integer> map = ...
Integer value = map["Key"];
The vote results were:
Extension methods and chaining
Method chaining allows methods that return void to be chained in a similar style to StringBuffer. Extension methods allow the calling of static methods in the style of instance methods:
List<String> list = ...
Utils.sort(Utils.filter(list, param));
list.filter(param).sort();
The vote results were:
Note that two options for Yes were given, but for simplicity, I have grouped those together in the results above.
String switch
This allows the use of String in switch statements:
switch (str) {
case "ONE": return 1;
case "TWO": return 2;
case "THREE": return 3;
}
The vote results were:
Typedef
This allows the aliasing of types:
import java.util.Map<String, Integer> as CodeValueMap;
The vote results were:
Multi-catch
This allows catching a set of exceptions in a single catch clause:
try {
} catch (IOException | SQLException ex) {
}
The vote results were:
Null-handling
This allows nulls to be handled in long expressions without causing a NullPointerException:
String result = a.b.c; String result = a?.b?.c;
The vote results were:
Whiteboard photo
