gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control system
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f734195)
raw | patch | inline | side by side (parent: f734195)
author | Doni Pracner <quinnuendo@gmail.com> | |
Sun, 8 Nov 2015 11:32:04 +0000 (12:32 +0100) | ||
committer | Doni Pracner <quinnuendo@gmail.com> | |
Sun, 8 Nov 2015 11:32:04 +0000 (12:32 +0100) |
Hash/Kancelarija.java | patch | blob | history | |
Hash/hash.pdf | patch | blob | history | |
Hash/hash.txt | patch | blob | history |
diff --git a/Hash/Kancelarija.java b/Hash/Kancelarija.java
index 372fb7d94a204104e6c5c6ca4606a0821da22130..1772ec49e2dd1566f026818791112a18f3273fd0 100644 (file)
--- a/Hash/Kancelarija.java
+++ b/Hash/Kancelarija.java
// 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() {
diff --git a/Hash/hash.pdf b/Hash/hash.pdf
index 4a1249a56e89a5b02d9409e95d45fbf46c6b439a..1b2fd1e9f46c828a93c20192b9c0919557aad6be 100644 (file)
Binary files a/Hash/hash.pdf and b/Hash/hash.pdf differ
Binary files a/Hash/hash.pdf and b/Hash/hash.pdf differ
diff --git a/Hash/hash.txt b/Hash/hash.txt
index 75e8cc753cac2811c467d743c443376bd8ad6de2..6c2075ab988fc8d91777ab05cf56d4f2ab31bdb1 100644 (file)
--- a/Hash/hash.txt
+++ b/Hash/hash.txt
// 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;
}
```