Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.util.SparseBooleanArray;
import java.util.ArrayList;

public class Main {
    public static <T> ArrayList<T> getIfTrue(T[] items, SparseBooleanArray booleanArray) {
        final ArrayList<T> values = new ArrayList<>();
        for (int i = 0; i < items.length; i++) {
            if (booleanArray.get(i, false)) {
                values.add(items[i]);
            }
        }
        return values;
    }
}