FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaArithmetic/src/datastructure/set/BSTSet.java at master · sqlcyi2008/JavaArithmetic · GitHub
sqlcyi2008
JavaArithmetic
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaArithmetic
/
src
/
datastructure
/
set
/
BSTSet.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
67 lines (49 loc) · 1.54 KB
Breadcrumbs
JavaArithmetic
/
src
/
datastructure
/
set
/
BSTSet.java
Copy path
File metadata and controls
67 lines (49 loc) · 1.54 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package
datastructure
.
set
;
import
java
.
util
.
ArrayList
;
public
class
BSTSet
<
E
extends
Comparable
<
E
>>
implements
Set
<
E
> {
private
BST
<
E
>
bst
;
public
BSTSet
(){
bst
=
new
BST
<>();
}
@
Override
public
int
getSize
(){
return
bst
.
size
();
}
@
Override
public
boolean
isEmpty
(){
return
bst
.
isEmpty
();
}
@
Override
public
void
add
(
E
e
){
bst
.
add
(
e
);
}
@
Override
public
boolean
contains
(
E
e
){
return
bst
.
contains
(
e
);
}
@
Override
public
void
remove
(
E
e
){
bst
.
remove
(
e
);
}
public
static
void
main
(
String
[]
args
) {
System
.
out
.
println
(
"Pride and Prejudice"
);
ArrayList
<
String
>
words1
=
new
ArrayList
<>();
if
(
FileOperation
.
readFile
(
"pride-and-prejudice.txt"
,
words1
)) {
System
.
out
.
println
(
"Total words: "
+
words1
.
size
());
BSTSet
<
String
>
set1
=
new
BSTSet
<>();
for
(
String
word
:
words1
)
set1
.
add
(
word
);
System
.
out
.
println
(
"Total different words: "
+
set1
.
getSize
());
}
System
.
out
.
println
();
System
.
out
.
println
(
"A Tale of Two Cities"
);
ArrayList
<
String
>
words2
=
new
ArrayList
<>();
if
(
FileOperation
.
readFile
(
"a-tale-of-two-cities.txt"
,
words2
)){
System
.
out
.
println
(
"Total words: "
+
words2
.
size
());
BSTSet
<
String
>
set2
=
new
BSTSet
<>();
for
(
String
word
:
words2
)
set2
.
add
(
word
);
System
.
out
.
println
(
"Total different words: "
+
set2
.
getSize
());
}
}
}
Back
|
FazBrowse Home
|
New Git URL