Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DAAExample
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Miguel Ferreiro Díaz
DAAExample
Commits
c1945554
Commit
c1945554
authored
Feb 21, 2019
by
miferreiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The functions of the pet entity, hashCode and equals, have been improved
parent
54cf0352
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
17 deletions
+2
-17
Pet.java
src/main/java/es/uvigo/esei/daa/entities/Pet.java
+2
-17
No files found.
src/main/java/es/uvigo/esei/daa/entities/Pet.java
View file @
c1945554
...
...
@@ -96,10 +96,7 @@ public class Pet {
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
specie
==
null
)
?
0
:
specie
.
hashCode
());
result
=
prime
*
result
+
id
;
result
=
prime
*
result
+
idOwner
;
result
=
prime
*
result
+
((
name
==
null
)
?
0
:
name
.
hashCode
());
return
result
;
}
...
...
@@ -109,22 +106,10 @@ public class Pet {
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
getClass
()
!=
obj
.
getClass
(
))
if
(
!(
obj
instanceof
Pet
))
return
false
;
Pet
other
=
(
Pet
)
obj
;
if
(
specie
==
null
)
{
if
(
other
.
specie
!=
null
)
return
false
;
}
else
if
(!
specie
.
equals
(
other
.
specie
))
return
false
;
if
(
id
!=
other
.
id
)
return
false
;
if
(
idOwner
!=
other
.
idOwner
)
return
false
;
if
(
name
==
null
)
{
if
(
other
.
name
!=
null
)
return
false
;
}
else
if
(!
name
.
equals
(
other
.
name
))
if
(
id
!=
other
.
id
)
return
false
;
return
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment