1. Tim Vernum
  2. syntactic

Commits

Tim Vernum  committed fa8c2e3

Show Java7 code output

  • Participants
  • Parent commits 9ac2421
  • Branches default

Comments (0)

Files changed (1)

File ConvertingJava8To7.md

View file
 * Generics _(`callable` and `cmp`)_
 * Generics with wildcards _(`cmp`)_
 
+The resulting Java 7 code for these statements is:
+
+    Runnable runnable = new Runnable() {
+        public void run() { System.out.println("Running!"); }
+    };
+
+    Callable<String> callable = new Callable<String>() {
+        public String call() throws java.lang.Exception { return "abc"; }
+    };
+
+    FileFilter filter = new FileFilter() { 
+        public boolean accept(java.io.File file) { return file.getName().endsWith(".xml"); }
+    };
+
+    javax.swing.event.ChangeListener listener = new javax.swing.event.ChangeListener() {
+        public void stateChanged(javax.swing.event.ChangeEvent event) { System.err.println("Event:"+event); }
+    };
+
+    Comparator<? super String> cmp = new Comparator<CharSequence>() {
+        public int compare(CharSequence a, CharSequence b) {
+            Integer l1 = a.length(), l2 = b.length();
+            return l1.compareTo(l2);
+        }
+    };
+
+
 
 Not Yet Supported Features
 --------------------------