Skip to content

Instantly share code, notes, and snippets.

@95Rajitha
Created May 10, 2021 16:48
Show Gist options
  • Save 95Rajitha/31d3bb4b11ee81dccda9132ba78105a0 to your computer and use it in GitHub Desktop.
Save 95Rajitha/31d3bb4b11ee81dccda9132ba78105a0 to your computer and use it in GitHub Desktop.
Class type erasure implementations
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