Compare commits
No commits in common. "c18ba394ae455a85c96a74d213888b04e2d33f41" and "af62145f7413c63daf77ab6e46efd2e0e369aa4a" have entirely different histories.
c18ba394ae
...
af62145f74
Binary file not shown.
@ -1,17 +0,0 @@
|
||||
public class Box<T> {
|
||||
|
||||
private T t;
|
||||
|
||||
public void set(T t){
|
||||
this.t = t;
|
||||
}
|
||||
|
||||
public T get(){
|
||||
return t;
|
||||
}
|
||||
|
||||
public String printContents(){
|
||||
return t.toString();
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
@ -1,42 +0,0 @@
|
||||
public class Tuple<T1, T2, T3> {
|
||||
|
||||
private T1 item1;
|
||||
private T2 item2;
|
||||
private T3 item3;
|
||||
|
||||
public Tuple(T1 item1, T2 item2, T3 item3){
|
||||
this.item1 = item1;
|
||||
this.item2 = item2;
|
||||
this.item3 = item3;
|
||||
}
|
||||
|
||||
public T1 getItem1(){
|
||||
return item1;
|
||||
}
|
||||
|
||||
public T2 getItem2(){
|
||||
return item2;
|
||||
}
|
||||
|
||||
public T3 getItem3(){
|
||||
return item3;
|
||||
}
|
||||
|
||||
|
||||
public void setItem1(T1 item1) {
|
||||
this.item1 = item1;
|
||||
}
|
||||
|
||||
public void setItem2(T2 item2) {
|
||||
this.item2 = item2;
|
||||
}
|
||||
|
||||
public void setItem3(T3 item3) {
|
||||
this.item3 = item3;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "item1" + item1 + "item2" + item2 + "item3" + item3;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
public class TupleDemo {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
Tuple <String, Integer, String> personTuple = new Tuple("John Doe", 21, "CS student");
|
||||
Tuple <String, Double, Boolean> itemTuple = new Tuple("Tablet", 13123, 1);
|
||||
|
||||
System.out.println(personTuple.getItem1() + personTuple.getItem2() + personTuple.getItem3());
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
public class demoSwap{
|
||||
|
||||
public static void main(String[] main) {
|
||||
Integer[] intArray = {1, 2, 3, 4, 5};
|
||||
swap.swap(intArray, 1, 3);
|
||||
System.out.print("New array: ");
|
||||
swap.printArray(intArray);
|
||||
}
|
||||
}
|
Binary file not shown.
@ -1,16 +0,0 @@
|
||||
public class swap {
|
||||
|
||||
public static <T> void swap(T[] array, int i1, int i2) {
|
||||
|
||||
T temp = array[i1];
|
||||
array[i1] = array[i2];
|
||||
array[i2] = temp;
|
||||
}
|
||||
|
||||
public static <T> void printArray(T[] array) {
|
||||
for (T element: array) {
|
||||
System.out.print(element + " ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user