From 0bff28f3b07eb21c6f659b20fd7a55de21d56453 Mon Sep 17 00:00:00 2001 From: Terry Kwan Date: Wed, 22 Nov 2023 16:26:50 +0100 Subject: [PATCH] terry: kleine Anderung in equals erste if Bedingung --- SparseVector.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SparseVector.java b/SparseVector.java index 0f86afc..632d1e2 100644 --- a/SparseVector.java +++ b/SparseVector.java @@ -118,6 +118,12 @@ public class SparseVector { //Terry: bool Methode equals: testen, ob other = this (nur vergleichen die Nicht-Null Elemente) public boolean equals(SparseVector other) { + if(this.getLength() != other.getLength()){ + + return false; + + } + Node thisnow = this.head; Node othernow = other.head; @@ -146,6 +152,7 @@ public class SparseVector { // Terry: void add: to add two vectors together and renew (overwrite) the this.vector public void add(SparseVector other) { + Node thisnow = this.head; Node othernow = other.head; Node thispre = null;