gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
Hash, doterivanje poredjenja kancelarija
authorDoni Pracner <quinnuendo@gmail.com>
Sun, 8 Nov 2015 11:32:04 +0000 (12:32 +0100)
committerDoni Pracner <quinnuendo@gmail.com>
Sun, 8 Nov 2015 11:32:04 +0000 (12:32 +0100)
Hash/Kancelarija.java
Hash/hash.pdf
Hash/hash.txt

index 372fb7d94a204104e6c5c6ca4606a0821da22130..1772ec49e2dd1566f026818791112a18f3273fd0 100644 (file)
@@ -46,12 +46,19 @@ public class Kancelarija extends InfoTip {
 
                // pretvaramo objekat u kancelariju
                Kancelarija k2 = (Kancelarija) o;
-               // poredimo polja
-               if (prezime.equals(k2.prezime) && broj == k2.broj) {
-                       return true;
+
+               // Prvo proveravamo broj
+               if (broj != other.broj) {
+                   return false;
+               }
+
+               // A potom prezime
+               if (!Objects.equals(prezime, other.prezime)) {
+                   return false;
                }
 
-               return false;
+               // Proverili smo polja i sva su jednaka
+               return true;
        }
 
        public int hashCode() {
index 4a1249a56e89a5b02d9409e95d45fbf46c6b439a..1b2fd1e9f46c828a93c20192b9c0919557aad6be 100644 (file)
Binary files a/Hash/hash.pdf and b/Hash/hash.pdf differ
index 75e8cc753cac2811c467d743c443376bd8ad6de2..6c2075ab988fc8d91777ab05cf56d4f2ab31bdb1 100644 (file)
@@ -283,12 +283,19 @@ Potpuna verzija bi izgledala ovako:
 
                // pretvaramo objekat u kancelariju
                Kancelarija k2 = (Kancelarija) o;
-               // poredimo polja
-               if (prezime.equals(k2.prezime) && broj == k2.broj) {
-                       return true;
+
+               // Prvo proveravamo broj
+               if (broj != other.broj) {
+                   return false;
                }
 
-               return false;
+               // A potom prezime
+               if (!Objects.equals(prezime, other.prezime)) {
+                   return false;
+               }
+
+               // Proverili smo polja i sva su jednaka
+               return true;
        }
 ```
 
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner