Android examples for android.util:SparseBooleanArray
Retrieves the existing integer indexes coming from provided SparseBooleanArray under which there is certain boolean value set.
//package com.java2s; import android.util.SparseBooleanArray; import java.util.ArrayList; import java.util.List; public class Main { /**/*ww w .jav a 2 s. com*/ * Retrieves the existing integer indexes coming from provided {@link SparseBooleanArray} under which there is * certain boolean {@code value} set. */ public static List<Integer> getIndexesFromSparseBooleanArray( SparseBooleanArray array, boolean value) { List<Integer> result = new ArrayList<Integer>(); for (int i = 0; i < array.size(); i++) { if (array.valueAt(i) == value) { result.add(array.keyAt(i)); } } return result; } }