2015-12-01 4 views
0

Я пытаюсь сделать это:Как добавить булевский массив в логический список?

NewRoomate(int studentID, List<Integer> rankedQuestions, boolean...trueFalseQuestions){ 
     this.studentID = studentID; 
     this.rankedQuestions = rankedQuestions; 
     List<Boolean> wef = Arrays.asList(trueFalseQuestions); 
    } 

Но компилятор не нравится. Проблемы: enter image description here

Как преобразовать все логические значения в массив trueFalseQuestions в список?

ответ

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); 
} 
+0

решаемые так быстро! Спасибо огромное! – Computor

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. 
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); 
     } 
    }