/* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template */ package generics; /** * * @author steve */ public class GenericListTest { public static void test(MinGenericList list) { final int N = 10; for (int i = 0; i < N; i++) { list.add(i); } int count = 0; if(list.size() != N) throw new Error(); for (var i : list) { System.out.println(i); count++; } if (count != N) { throw new Error(); } if (!list.get(3).equals(3)) { throw new Error(); } list.set(3, 28); if (!list.get(3).equals(28)) { throw new Error(); } } }