Last active
April 25, 2018 20:35
-
-
Save fhanik/9645aebb79d0a5b50a4e03d51aa12b5c to your computer and use it in GitHub Desktop.
Java Generics Question
This file contains 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 characters
public class A { | |
public T setSomething() { | |
return this; | |
} | |
} | |
public class B { | |
public T setSomethingElse() { | |
return this; | |
} | |
} | |
public class C { | |
public T anotherSet() { | |
return this; | |
} | |
} | |
//I would like this to work | |
C c = new C() | |
.setSomething() //returns A | |
.setSomethingElse() //returns B | |
.anotherSet(); //returns C | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment