Last active
August 29, 2015 13:57
-
-
Save archie/9784771 to your computer and use it in GitHub Desktop.
Revisions
-
archie revised this gist
Mar 26, 2014 . 1 changed file with 0 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -25,22 +25,4 @@ public void process4(List<? extends Item> items) { for (Item i : items) i.process(); } } -
archie revised this gist
Mar 26, 2014 . 1 changed file with 0 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,16 +0,0 @@ -
archie revised this gist
Mar 26, 2014 . 1 changed file with 16 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ public void process3(java.util.List<?>); Code: 0: aload_1 1: invokeinterface #2, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator; 6: astore_2 7: aload_2 8: invokeinterface #3, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z 13: ifeq 31 16: aload_2 17: invokeinterface #4, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object; 22: astore_3 23: aload_3 24: invokevirtual #5 // Method java/lang/Object.toString:()Ljava/lang/String; 27: pop 28: goto 7 31: return -
archie revised this gist
Mar 26, 2014 . 3 changed files with 8 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,22 +6,22 @@ public class Viewer { public void process1(List<Object> items) { for (Object i : items) i.toString(); } public void process2(List<Item> items) { for (Item i : items) i.process(); } public void process3(List<?> items) { for (Object i : items) i.toString(); } public void process4(List<? extends Item> items) { for (Item i : items) i.process(); } -
archie created this gist
Mar 26, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ package wild; public interface Item { void process(); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ package wild; public interface TwitterItem extends Item { } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ package wild; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Viewer { public void process(List<Object> items) { for (Object i : items) i.toString(); } public void process2(List<?> items) { for (Object i : items) i.toString(); } public void process3(List<? extends Item> items) { for (Item i : items) i.process(); } public void process4(List<Item> items) { for (Item i : items) i.process(); } public static void main(String[] args) { Viewer viewer = new Viewer(); viewer.process3(new ArrayList<TwitterItem>(Arrays.asList(new TwitterItem() { @Override public void process() { // some computation } @Override public String toString() { return "twitteritem"; } }))); } }