Here you can find the source of toSet(SparseBooleanArray array)
public static Set<Integer> toSet(SparseBooleanArray array)
//package com.java2s; //License from project: Apache License import java.util.Set; import android.util.SparseBooleanArray; import com.google.common.collect.Sets; public class Main { public static Set<Integer> toSet(SparseBooleanArray array) { Set<Integer> trueSet = Sets.newHashSet(); for (int i = 0; i < array.size(); i++) { if (array.valueAt(i)) { int position = array.keyAt(i); trueSet.add(position);/* w w w . j a v a 2s . c o m*/ } } return trueSet; } }