43 lines
726 B
Java
43 lines
726 B
Java
import java.util.Vector;
|
|
import java.lang.Integer;
|
|
import java.lang.String;
|
|
import java.lang.Byte;
|
|
import java.lang.Boolean;
|
|
//import java.util.Vector;
|
|
//import java.util.Collection;
|
|
/*
|
|
public class VectorAdd {
|
|
|
|
add(v1, v2) {
|
|
var ret = new Vector();
|
|
var i = 0;
|
|
var erg;
|
|
while(i < v1.size()) {
|
|
erg = v1.elementAt(i) + v2.elementAt(i);
|
|
ret.addElement(erg);
|
|
}
|
|
v1.addAll
|
|
return ret;
|
|
}
|
|
}
|
|
*/
|
|
|
|
public class VectorAdd {
|
|
vectorAdd(v1, v2) {
|
|
var i = 0;
|
|
var erg = new Vector<>();
|
|
while (i < v1.size()) {
|
|
erg.addElement(v1.elementAt(i) + v2.elementAt(i));
|
|
i++;
|
|
}
|
|
return erg;
|
|
}
|
|
|
|
//addEle(z) {
|
|
// var x;
|
|
// var y;
|
|
// x.add(y);
|
|
// z = x;
|
|
// }
|
|
}
|