/***** 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 */ |
Cet article Java-source: Obtenir la veleur maximale d’un HashSet est apparu en premier sur .