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 SampleChild extends Sample { | |
public void putItem(Object data) { | |
putItem((Integer)data); | |
} | |
public void putItem(Integer val) { | |
super.putItem(val); | |
} |
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 SampleChild extends Sample<Integer> { | |
public SampleChild(int size) { | |
super(size); | |
} | |
public void putItems(Integer data) { | |
super.putItems(data); | |
} | |
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
//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); | |
} |
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
// 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); |
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{ | |
private Comparable [] listOfItems; | |
public Sample(int size) { | |
this.listOfItems = (Comparable[]) new Object[size]; | |
} | |
public void putItems(Comparable data) { | |
// implementation | |
} |
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 extends Comparable<E>> { | |
private E[] listOfItems; | |
public Sample(int size) { | |
this.listOfItems = (E[]) new Object[size]; | |
} | |
public void putItems(E data) { | |
// implementation | |
} |
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 { | |
private Object[] listOfItems; | |
public Stack(int size) { | |
this.listOfItems = (Object[]) new Object[size]; | |
} | |
public void putItems(Object data) { | |
// 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 | |
} |
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
pulic class Sample | |
{ | |
private Object inputItems; | |
public Object emptyBucket() | |
{ | |
return inputItems; | |
} | |
public void dropToBucket(Object inputItems) | |
{ |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder