Created
May 10, 2021 16:48
-
-
Save 95Rajitha/31d3bb4b11ee81dccda9132ba78105a0 to your computer and use it in GitHub Desktop.
Class type erasure implementations
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 Sample<E> { | |
private E[] listOfItems; | |
public Sample(int size) { | |
this.listOfItems = (E[]) new Object[size]; | |
} | |
public void putItems(E data) { | |
// implementations | |
} | |
public E getItems() { | |
// implementations | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment