Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.TreeSet;
import java.util.Iterator;

public class Main {
    public static void main(String[] args) {
        TreeSet<Integer> treeadd = new TreeSet<Integer>();

        treeadd.add(1);
        treeadd.add(2);
        treeadd.add(3);
        treeadd.add(4);
        treeadd.add(5);
        treeadd.add(6);
        treeadd.add(7);
        treeadd.add(8);

        TreeSet<Integer> treetailsetincl = (TreeSet<Integer>) treeadd.tailSet(5, true);

        Iterator<Integer> iterator = treetailsetincl.iterator();

        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}