Bonjour,
Je ne comprend pas pourquoi cela ne fonctionne pas.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 import java.util.ArrayList; public class Ligne { private int idLigne; private ArrayList<Data<?>> datas; <T> void setData(int idColonne,T data) { this.datas.get(idColonne).setData( data); } int getIdLigne() { return this.idLigne; } }Eclipse me dit qu'il y a une erreur sur la fonction <T> void setData :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 public class Data<T> { static int idData = 1; T data; Data() { idData++; } /** * @return the data */ T getData() { return data; } void setData(T data) { // TODO Auto-generated method stub } }
merci d'avanceThe method setData(capture#1-of ?) in the type Data<capture#1-of ?> is not applicable for the arguments (T)
Partager