It's not 1.0, but I had occasion to run a snippet of code on JDK 1.2 the other day to see how it behaved. Here's how it went:
// what I wanted
var strings = List.of("a", "b");
// get rid of var
List<String> strings = List.of("a", "b");
// get rid of collections factory
List<String> strings = new ArrayList<>(Arrays.asList("a", "b"));
// get rid of diamond
List<String> strings = new ArrayList<String>(Arrays.asList("a", "b"));
// get rid of generics
List strings = new ArrayList(Arrays.asList("a", "b"));
// get rid of varargs
List strings = new ArrayList(Arrays.asList(new String[] { "a", "b" }));
// oh that's ugly just add the strings explicitly
List strings = new ArrayList();
strings.add("a");
strings.add("b");
12
u/OtherOtherNeRd May 21 '20
Anyone else want to write some programs in Java 1.0 for some frustrating nostalgia?