Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
Java. training
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Qazi Zain
Java. training
Commits
edcbcf08
Commit
edcbcf08
authored
Oct 09, 2024
by
Qazi Zain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set Interfaces added
parent
20278587
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
0 deletions
+57
-0
CoustomHashSet.java
src/SetInterface/HashSet/CoustomHashSet.java
+49
-0
Main.java
src/SetInterface/HashSet/Main.java
+8
-0
No files found.
src/SetInterface/HashSet/CoustomHashSet.java
0 → 100644
View file @
edcbcf08
package
SetInterface
.
HashSet
;
import
java.util.*
;
public
class
CoustomHashSet
{
HashSet
<
String
>
obj
=
new
HashSet
<>();
CoustomHashSet
()
{
System
.
out
.
println
(
"Object is Created!"
);
}
void
displayHasetFunction
()
{
//adding elements in HashSet.
obj
.
add
(
"zain"
);
obj
.
add
(
"Maaz"
);
obj
.
add
(
"Hurriyah"
);
obj
.
add
(
"Fatima"
);
obj
.
add
(
"zain"
);
// would not add duplicate values.
System
.
out
.
println
(
"Your Hashset is:"
+
obj
);
// search in hashset
if
(
obj
.
contains
(
"zain"
))
{
System
.
out
.
println
(
"Present in The List"
);
}
// for delete in HashSet
obj
.
remove
(
"Hurriyah"
);
System
.
out
.
println
(
"Your Hashset is:"
+
obj
);
}
}
src/SetInterface/HashSet/Main.java
0 → 100644
View file @
edcbcf08
package
SetInterface
.
HashSet
;
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
CoustomHashSet
obj
=
new
CoustomHashSet
();
obj
.
displayHasetFunction
();
}
}
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