集册 Java实例教程 查找HashSet的Minimum元素

查找HashSet的Minimum元素

欢马劈雪     最近更新时间:2020-01-02 10:19:05

476
查找哈希集的最小元素


 /** from 时 代 J a v a - nowjava.com**/

import java.util.HashSet;

import java.util.Collections;

 

public class Main {

 

  public static void main(String[] args) {

   

    //create a HashSet object

    HashSet hashSet = new HashSet();

   

    //Add elements to HashSet

    hashSet.add(new Long("91111111111111111111"));

    hashSet.add(new Long("4"));/**n o w j a v a . c o m**/

    hashSet.add(new Long("2"));

    hashSet.add(new Long("2"));

    hashSet.add(new Long(
展开阅读全文