Skip to content

Commit

Permalink
Add Generics code snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
100yo committed Nov 10, 2023
1 parent 5c46682 commit bece857
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 85 deletions.
1 change: 1 addition & 0 deletions 05-generics/snippets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Generics / Code snippets
24 changes: 24 additions & 0 deletions 05-generics/snippets/src/BridgeMethods.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class Box<T> {
private T value;

public void setValue(T value) {
this.value = value;
}
}

class BoxOfInt extends Box<Integer> {
private Integer value;

public void setValue(Integer value) {
this.value = value;
}
}

public class BridgeMethods {

public static void main(String... args) {
Box<Integer> boxOfInt = new BoxOfInt();
boxOfInt.setValue(1);
}

}
85 changes: 0 additions & 85 deletions 05-generics/snippets/src/BridgeMethodsExample.java

This file was deleted.

0 comments on commit bece857

Please sign in to comment.