Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.view.View;

import java.util.ArrayList;

public class Main {
    /**
     * Filters all Views not within the given set.
     *
     * @param classSet contains all classes that are ok to pass the filter
     * @param viewList the Iterable to filter form
     * @return an ArrayList with filtered views
     */
    public static ArrayList<View> filterViewsToSet(Class<View> classSet[], Iterable<View> viewList) {
        ArrayList<View> filteredViews = new ArrayList<View>();
        for (View view : viewList) {
            if (view == null)
                continue;
            for (Class<View> filter : classSet) {
                if (filter.isAssignableFrom(view.getClass())) {
                    filteredViews.add(view);
                    break;
                }
            }
        }
        return filteredViews;
    }
}