Skip to content

Commit 7346bed

Browse files
committed
🔨 Uniformisation des type retournés
1 parent 6b2216d commit 7346bed

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/main/java/fr/france/Departement.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* @see Region
2828
*
2929
* @author MathieuSoysal
30-
* @version 1.0.0
30+
* @version 1.0.1
3131
*/
3232
public enum Departement {
3333
AIN(1, StatutDepartement.DPT, "Ain", "Bourg-en-Bresse", Region.AUVERGNE_RHONE_ALPES), //
@@ -560,11 +560,11 @@ public static Departement rechercherParCode(String code) {
560560
*
561561
* @param statut des départements devant être cherchés
562562
*
563-
* @return Un tableau de {@code Departement} correpondants au statut donné
563+
* @return Une liste des {@code Departement} correpondants au statut donné
564564
*
565565
* @see StatutDepartement
566566
*/
567-
public static Departement[] filtrerParStatut(StatutDepartement statut) {
567+
public static List<Departement> filtrerParStatut(StatutDepartement statut) {
568568
return OutilsDepartement.filtrerDepartementsParStatut(statut);
569569
}
570570

src/main/java/fr/france/Region.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* @see Departement
2424
*
2525
* @author MathieuSoysal
26-
* @version 1.0.0
26+
* @version 1.0.1
2727
*/
2828
public enum Region {
2929
/**
@@ -103,7 +103,7 @@ public enum Region {
103103
*/
104104
DEPARTEMENT_NON_RATTACHE_A_UNE_REGION("Département non rattaché à une région.");
105105

106-
private Departement[] departements;
106+
private List<Departement> departements;
107107
private String nom;
108108

109109
/**
@@ -151,7 +151,7 @@ public static Region rechercherParDepartement(Departement departement) {
151151
*
152152
* @see Departement
153153
*/
154-
public Departement[] getDepartements() {
154+
public List<Departement> getDepartements() {
155155
if (departements == null)
156156
departements = OutilsDepartement.filtrerDepartementsParRegion(this);
157157
return departements;

src/main/java/fr/france/outils/OutilsDepartement.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ private OutilsDepartement() {
3535
private static final RepertoireGenerique<Departement> REPERTOIRE_NOM = new RepertoireGenerique<>(Departement.class);
3636
private static final Map<Departement, List<Caumune>> REPERTOIRE_CAUMUNE = initialiserRepertoireCaumune();
3737

38-
public static Departement[] filtrerDepartementsParRegion(Region region) {
39-
Collection<Departement> result = new ArrayList<>();
38+
public static List<Departement> filtrerDepartementsParRegion(Region region) {
39+
List<Departement> result = new ArrayList<>();
4040
for (Departement dep : Departement.values())
4141
if (dep.getRegion().equals(region))
4242
result.add(dep);
43-
return result.toArray(new Departement[0]);
43+
return result;
4444
}
4545

46-
public static Departement[] filtrerDepartementsParStatut(StatutDepartement statut) {
47-
Collection<Departement> result = new ArrayList<>();
46+
public static List<Departement> filtrerDepartementsParStatut(StatutDepartement statut) {
47+
List<Departement> result = new ArrayList<>();
4848
for (Departement dep : Departement.values())
4949
if (dep.getStatut().equals(statut))
5050
result.add(dep);
51-
return result.toArray(new Departement[0]);
51+
return result;
5252
}
5353

5454
public static Departement rechercherParNom(String nom) {

0 commit comments

Comments
 (0)