Obtenir la valeur maximale des éléments d’une ArrayList

Author:

 list, list, arrayList, collection, collection, arrayList, java
{filelink=4857}


import java.util.ArrayList;
import java.util.Collections;

public class ArrayL_Max
 {

  public static void main(String[] args) {

    ArrayList array_L = new ArrayList();

    array_L.add(5);
    array_L.add(9);
    array_L.add(-85);
    array_L.add(4);

   // Retourner la plus grande valeur
    Object obj = Collections.max(array_L);
    System.out.println(obj);              // "9"
  }
}

Leave a Reply

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