List of usage examples for android.util SparseBooleanArray indexOfKey
public int indexOfKey(int key)
From source file:Main.java
/** * Checks whether a provided answer is correct. * * @param checkedItems The items that were selected. * @param answerIds The actual correct answer ids. * @return <code>true</code> if correct else <code>false</code>. */// www .j av a 2s . c o m public static boolean isAnswerCorrect(SparseBooleanArray checkedItems, int[] answerIds) { if (null == checkedItems || null == answerIds) { Log.i(TAG, "isAnswerCorrect got a null parameter input."); return false; } for (int answer : answerIds) { if (0 > checkedItems.indexOfKey(answer)) { return false; } } return checkedItems.size() == answerIds.length; }
From source file:Main.java
/** * Checks whether a provided answer is correct. * * @param checkedItems The items that were selected. * @param answerIds The actual correct answer ids. * @return <code>true</code> if correct else <code>false</code>. *//*from w w w. j a v a 2 s .c om*/ public static boolean isAnswerCorrect(SparseBooleanArray checkedItems, int[] answerIds) { if (null == checkedItems || null == answerIds) { Log.i(TAG, "isAnswerCorrect got a null parameter input."); return false; } for (int answer : answerIds) { if (0 > checkedItems.indexOfKey(answer)) { return false; } } return true; }