FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Collection-Framework-and-Java-Set/TreeSetDemo7.java at main · AvinandanBose/Java-Collection-Framework-and-Java-Set · GitHub
AvinandanBose
/
Java-Collection-Framework-and-Java-Set
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
7
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Collection-Framework-and-Java-Set
/
TreeSetDemo7.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
21 lines (20 loc) · 776 Bytes
Breadcrumbs
Java-Collection-Framework-and-Java-Set
/
TreeSetDemo7.java
Copy path
File metadata and controls
21 lines (20 loc) · 776 Bytes
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
package
TreeSet
;
import
java
.
util
.
TreeSet
;
public
class
TreeSetDemo7
{
public
static
void
main
(
String
[]
args
) {
// Create a TreeSet of String objects.
TreeSet
<
Float
>
ts
=
new
TreeSet
<>();
ts
.
add
(
10.58f
);
ts
.
add
(
20.78f
);
ts
.
add
(
30.65f
);
ts
.
add
(
40.78f
);
ts
.
add
(
50.98f
);
ts
.
add
(
60.65f
);
TreeSet
<
Float
>
ts1
=
new
TreeSet
<>();
ts1
.
addAll
(
ts
.
subSet
(
20.78f
,
true
,
60.65f
,
true
));
System
.
out
.
println
(
"(Sub Set)Elements in the range 20.78 to 40.78 are:"
+
ts1
);
System
.
out
.
println
(
ts
.
subSet
(
20.78f
,
true
,
40.78f
,
true
));
System
.
out
.
println
(
ts
.
subSet
(
20.78f
,
false
,
40.78f
,
true
));
System
.
out
.
println
(
ts
.
subSet
(
20.78f
,
true
,
40.78f
,
false
));
}
}
Back
|
FazBrowse Home
|
New Git URL