// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/util/CollectionUtils.java
// public final class CollectionUtils {
// 
//     private CollectionUtils() {
//         // hide
//     }
// 
// 
//     public interface Predicate<T> {
//         boolean apply(T type);
//     }
// 
//     public interface Function1<T, G> {
//         T call(G value);
//     }
// 
//     public static <L> ArrayList<L> filter(List<L> list, Predicate<L> predicate) {
//         ArrayList<L> result = new ArrayList<L>();
//         for (L element : list) {
//             if (predicate.apply(element)) {
//                 result.add(element);
//             }
//         }
//         return result;
//     }
// 
//     public static <T, G> ArrayList<T> map(List<G> input, Function1<T, G> function) {
//         ArrayList<T> result = new ArrayList<T>(input.size());
//         for (G item : input) {
//             result.add(function.call(item));
//         }
//         return result;
//     }
// 
//     public static <T, G> Set<T> map(Set<G> input, Function1<T, G> function) {
//         Set<T> result = new HashSet<T>(input.size());
//         for (G item : input) {
//             result.add(function.call(item));
//         }
//         return result;
//     }
// 
//     public static boolean isNullOrEmpty(Collection<?> input) {
//         return input == null || input.isEmpty();
//     }
// 
//     public static List<Integer> asList(int... ids) {
//         final List<Integer> result = new ArrayList<>(ids.length);
//         for (int id : ids) {
//             result.add(id);
//         }
//         return result;
//     }
// 
//     public static <T> Set<T> asSet(T... items) {
//         final HashSet<T> result = new HashSet<>(items.length);
//         result.addAll(Arrays.asList(items));
//         return Collections.unmodifiableSet(result);
//     }
// }


import android.app.Activity;
import com.mindcoders.phial.internal.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
package com.mindcoders.phial;




/**
 * Created by rost on 11/15/17.
 */

public class PhialPageBuilder {
    private final String id;
    private final int iconResourceId;
    private final CharSequence title;
    private final Page.PageViewFactory pageViewFactory;
    private final Set<TargetScreen> screens = new HashSet<>();

    public PhialPageBuilder(String id, int iconResourceId, CharSequence title, Page.PageViewFactory pageViewFactory) {
        this.id = id;
        this.iconResourceId = iconResourceId;
        this.title = title;
        this.pageViewFactory = pageViewFactory;
    }

    /**
     * Sets activities on which the page should be visible.
     * @return the same instance of {@link PhialPageBuilder}
     */
    public PhialPageBuilder visibleOnActivities(Class<? extends Activity>... activities) {
        return this.visibleOnActivities(Arrays.asList(activities));
    }

    /**
     * @see PhialPageBuilder#visibleOnActivities
     */
    public PhialPageBuilder visibleOnActivities(List<Class<? extends Activity>> activities) {
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/util/CollectionUtils.java
// public final class CollectionUtils {
// 
//     private CollectionUtils() {
//         // hide
//     }
// 
// 
//     public interface Predicate<T> {
//         boolean apply(T type);
//     }
// 
//     public interface Function1<T, G> {
//         T call(G value);
//     }
// 
//     public static <L> ArrayList<L> filter(List<L> list, Predicate<L> predicate) {
//         ArrayList<L> result = new ArrayList<L>();
//         for (L element : list) {
//             if (predicate.apply(element)) {
//                 result.add(element);
//             }
//         }
//         return result;
//     }
// 
//     public static <T, G> ArrayList<T> map(List<G> input, Function1<T, G> function) {
//         ArrayList<T> result = new ArrayList<T>(input.size());
//         for (G item : input) {
//             result.add(function.call(item));
//         }
//         return result;
//     }
// 
//     public static <T, G> Set<T> map(Set<G> input, Function1<T, G> function) {
//         Set<T> result = new HashSet<T>(input.size());
//         for (G item : input) {
//             result.add(function.call(item));
//         }
//         return result;
//     }
// 
//     public static boolean isNullOrEmpty(Collection<?> input) {
//         return input == null || input.isEmpty();
//     }
// 
//     public static List<Integer> asList(int... ids) {
//         final List<Integer> result = new ArrayList<>(ids.length);
//         for (int id : ids) {
//             result.add(id);
//         }
//         return result;
//     }
// 
//     public static <T> Set<T> asSet(T... items) {
//         final HashSet<T> result = new HashSet<>(items.length);
//         result.addAll(Arrays.asList(items));
//         return Collections.unmodifiableSet(result);
//     }
// }


// Path: phial-overlay/src/main/java/com/mindcoders/phial/PhialPageBuilder.java
import android.app.Activity;
import com.mindcoders.phial.internal.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

package com.mindcoders.phial;




/**
 * Created by rost on 11/15/17.
 */

public class PhialPageBuilder {
    private final String id;
    private final int iconResourceId;
    private final CharSequence title;
    private final Page.PageViewFactory pageViewFactory;
    private final Set<TargetScreen> screens = new HashSet<>();

    public PhialPageBuilder(String id, int iconResourceId, CharSequence title, Page.PageViewFactory pageViewFactory) {
        this.id = id;
        this.iconResourceId = iconResourceId;
        this.title = title;
        this.pageViewFactory = pageViewFactory;
    }

    /**
     * Sets activities on which the page should be visible.
     * @return the same instance of {@link PhialPageBuilder}
     */
    public PhialPageBuilder visibleOnActivities(Class<? extends Activity>... activities) {
        return this.visibleOnActivities(Arrays.asList(activities));
    }

    /**
     * @see PhialPageBuilder#visibleOnActivities
     */
    public PhialPageBuilder visibleOnActivities(List<Class<? extends Activity>> activities) {
        final ArrayList<TargetScreen> screensToAdd = CollectionUtils.map(activities,