Java-source: Obtenir la veleur maximale d’un HashSet

Author:

Java-source: Obtenir la veleur maximale d'un HashSet
{filelink=401}

/***** Code de MesExemples.com *******/
import java.util.HashSet;
import java.util.Collections;

 class ExempleMaxHashSet
{

public static void main(String[] args) {


HashSet hashSet = new HashSet();


hashSet.add(new Long("587152410"));
hashSet.add(new Long("8851224102"));
hashSet.add(new Long("58755419218"));
hashSet.add(new Long("63528741584"));
hashSet.add(new Long("85749554152"));


Object obj = Collections.max(hashSet);

System.out.println("la valeur maximale de HashSet est: " + obj);
}
}
/*
Output would be
Maximum Element of Java HashSet is : 32987432984
*/

A Voir sur le même Sujet:

  • java enlever une valeur max dun tableau
  • police avec les veleur
  • codesource de hashset

Leave a Reply

Your email address will not be published. Required fields are marked *