Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LectureCode INF102 V24
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
antoine.hureau
LectureCode INF102 V24
Commits
0e7da63a
Commit
0e7da63a
authored
6 months ago
by
Martin Vatshelle
Browse files
Options
Downloads
Patches
Plain Diff
Code for use in lecture
parent
1dd64a27
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/lecture8/HashCode.java
+52
-0
52 additions, 0 deletions
src/main/java/lecture8/HashCode.java
with
52 additions
and
0 deletions
src/main/java/lecture8/HashCode.java
0 → 100644
+
52
−
0
View file @
0e7da63a
package
lecture8
;
public
class
HashCode
{
public
static
void
main
(
String
[]
args
)
{
Pair
p1
=
new
Pair
(
1
,
4
);
Pair
p2
=
new
Pair
(
1
,
4
);
System
.
out
.
println
(
p1
.
equals
(
p2
));
}
}
class
Pair
{
private
int
a
;
private
int
b
;
public
Pair
(
int
a
,
int
b
)
{
this
.
a
=
a
;
this
.
b
=
b
;
}
public
int
getA
()
{
return
a
;
}
public
void
setA
(
int
a
)
{
this
.
a
=
a
;
}
public
int
getB
()
{
return
b
;
}
public
void
setB
(
int
b
)
{
this
.
b
=
b
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
obj
instanceof
Pair
)
{
Pair
other
=
(
Pair
)
obj
;
return
a
==
other
.
a
&&
b
==
other
.
b
;
}
else
{
return
false
;
}
}
@Override
public
String
toString
()
{
return
"("
+
a
+
","
+
b
+
")"
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment