// MODULE: Collections.java // AUTEUR: felipe // OBJET: introduction aux collections import java.util.*; // ------------------------------------------------------- // la classe principale // ------------------------------------------------------- public class Collections { static private int entiers[] = {23,2,4,5,6,6,9,8,12}; static private double flottants[] = {12.3, 1.2, 3.2, 5.6, 3.1, 78.2, 4.2}; // --------------------------------------------------- static void afficheTableaux() { System.out.println("entiers: "); for (int i=0; i=0 ) System.out.println("12 existe dans entiers a l'indice " + indice); System.out.println("4.2 dans flottants ? " + Arrays.binarySearch(flottants,4.2)); // remplissage de tout ou partie d'un tableau avec un element Arrays.fill(entiers,10); Arrays.fill(flottants,2,4,0.0); afficheTableaux(); double flottants2 [] = new double [flottants.length]; System.arraycopy(flottants,0,flottants2,0,flottants.length); System.out.println("flottants == flottants2 ? " + Arrays.equals(flottants,flottants2)); } // --------------------------------------------------- public static void main (String args []) { collectionArray(); } }