We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a5c61f5 commit ae780a7Copy full SHA for ae780a7
TreeSetDemo6.java
@@ -0,0 +1,20 @@
1
+package TreeSet;
2
+
3
+import java.util.TreeSet;
4
+public class TreeSetDemo6 {
5
+ public static void main(String[] args) {
6
+ // Create a TreeSet of String objects.
7
+ TreeSet<Float> ts = new TreeSet<>();
8
+ ts.add(10.58f);
9
+ ts.add(20.78f);
10
+ ts.add(30.65f);
11
+ ts.add(40.78f);
12
+ ts.add(50.98f);
13
+ ts.add(60.65f);
14
+ TreeSet<Float> ts1 = new TreeSet<>();
15
+ ts1.addAll(ts.subSet(20.78f, 40.78f));
16
+ System.out.println("(Sub Set)Elements in the range 20.78 to 40.78 are:" + ts1);
17
+ System.out.println(ts.subSet(20.78f, 40.78f));
18
19
+ }
20
+}
0 commit comments