我正在尝试这样做:
NewRoomate(int studentID, List<Integer> rankedQuestions, boolean...trueFalseQuestions){
this.studentID = studentID;
this.rankedQuestions = rankedQuestions;
List<Boolean> wef = Arrays.asList(trueFalseQuestions);
}
如何将trueFalseQuestions数组中的所有布尔值转换为List?
答案 0 :(得分:1)
将boolean...trueFalseQuestions
更改为Boolean...trueFalseQuestions
结果将是:
NewRoomate(int studentID, List<Integer> rankedQuestions, Boolean...trueFalseQuestions){
this.studentID = studentID;
this.rankedQuestions = rankedQuestions;
List<Boolean> wef = Arrays.asList(trueFalseQuestions);
}
答案 1 :(得分:0)
NewRoomate(int studentID, List<Integer> rankedQuestions, Boolean...trueFalseQuestions){
this.studentID = studentID;
this.rankedQuestions = rankedQuestions;
List<Boolean> wef = Arrays.asList(trueFalseQuestions);
}
Just make it to Boolean from boolean.
答案 2 :(得分:0)
NewRoomate(int studentID, List<Integer> rankedQuestions, boolean...trueFalseQuestions){
this.studentID = studentID;
this.rankedQuestions = rankedQuestions;
List<Boolean> wef = new ArrayList<Boolean>(); //initiate your list
for(boolean question : trueFalseQuestions){ //fill your list with questions
wef.add(question);
}
}