Skip to content

Instantly share code, notes, and snippets.

View 95Rajitha's full-sized avatar
💭
<Tech Enthusiast/>

Rajitha Bandara 95Rajitha

💭
<Tech Enthusiast/>
  • University of Moratuwa
  • Colombo,Sri Lanka
View GitHub Profile
@95Rajitha
95Rajitha / dataPreprocessing.ipynb
Created June 7, 2020 16:10
Data Preprocessing in Machine Learning
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@95Rajitha
95Rajitha / Preprocessing.ipynb
Created June 27, 2020 17:17
this is all about the data preprocessing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@95Rajitha
95Rajitha / Sample.java
Created May 10, 2021 16:01
Type Erasure explanation in java
pulic class Sample
{
private Object inputItems;
public Object emptyBucket()
{
return inputItems;
}
public void dropToBucket(Object inputItems)
{
@95Rajitha
95Rajitha / Sample.java
Created May 10, 2021 16:48
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
}
@95Rajitha
95Rajitha / Sample.java
Last active May 10, 2021 16:50
compiler backstage job for class type erasure
public class Sample {
private Object[] listOfItems;
public Stack(int size) {
this.listOfItems = (Object[]) new Object[size];
}
public void putItems(Object data) {
// implementations
}
@95Rajitha
95Rajitha / Sample.java
Last active May 10, 2021 18:36
Type erasure when the type parameter is bounded
public class Sample<E extends Comparable<E>> {
private E[] listOfItems;
public Sample(int size) {
this.listOfItems = (E[]) new Object[size];
}
public void putItems(E data) {
// implementation
}
@95Rajitha
95Rajitha / Sample.java
Last active May 10, 2021 18:35
after the comiler replacement.
public class Sample{
private Comparable [] listOfItems;
public Sample(int size) {
this.listOfItems = (Comparable[]) new Object[size];
}
public void putItems(Comparable data) {
// implementation
}
@95Rajitha
95Rajitha / Example.java
Last active May 11, 2021 09:51
Method level type erasure for Unbound
// Following method decleration with generic types
public static <E> void countElements(E[] array) {
private int count=0;
for (E element : array) {
count++;
}
System.out.println(count);
@95Rajitha
95Rajitha / Example.java
Created May 11, 2021 09:49
bounded type erasure for method level erasure
//method declartation to elaborate bounded method type parameter
public static <E extends Comparable<E>> void countElements(E[] array) {
private int count =0;
for (E element : array) {
count++;
}
System.out.println(count);
}