Source Code : Find Minimum element of Java HashSet
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Find Minimum element of Java HashSet
import java.util.Collections;
import java.util.HashSet;
public class Main {
public static void main(String[] args) {
HashSet<Long> hashSet = new HashSet<Long>();
hashSet.add(new Long("9"));
hashSet.add(new Long("4"));
hashSet.add(new Long("2"));
hashSet.add(new Long("2"));
hashSet.add(new Long("3"));
Object obj = Collections.min(hashSet);
System.out.println("Minimum Element of Java HashSet is : " + obj);
}
}
Thank with us