// Path: app/src/main/java/com/zulip/android/util/TypeSwapper.java
// public interface TypeSwapper<GIVEN, RETURN> {
//     RETURN convert(GIVEN given);
// 
// }
// 
// Path: app/src/main/java/com/zulip/android/util/ZLog.java
// public class ZLog {
// 
//     private ZLog() {
//     }
// 
//     public static void logException(Throwable e) {
//         if (!BuildHelper.shouldLogToCrashlytics()) {
//             Log.e("Error", "oops", e);
//         } else {
//             Crashlytics.logException(e);
//         }
//     }
// 
//     public static void log(String message) {
//         if (!BuildHelper.shouldLogToCrashlytics()) {
//             Log.e("Error", message);
//         } else {
//             Crashlytics.log(message);
//         }
//     }
// }


import android.support.annotation.Nullable;
import com.google.gson.annotations.SerializedName;
import com.zulip.android.util.TypeSwapper;
import com.zulip.android.util.ZLog;
import java.util.ArrayList;
import java.util.List;
    private int handlerId;

    @SerializedName("events")
    private List<EventsBranch> events;

    @Nullable
    public <T> List<T> getEventsOf(EventsBranch.BranchType branchType) {
        return getEventsOf(branchType, null);
    }

    @Nullable
    public <T extends EventsBranch, R> List<R> getEventsOf(EventsBranch.BranchType branchType, TypeSwapper<T, R> converter) {
        if (events == null) {
            return null;
        }
        try {
            List<R> types = new ArrayList<>(events.size());
            for (int i = 0; i < events.size(); i++) {
                EventsBranch orig = events.get(i);
                if (orig.getClass().equals(branchType.getKlazz())) {
                    if (converter != null) {
                        types.add(converter.convert((T) orig));
                    } else {
                        types.add((R) orig);
                    }
                }
            }
            return types;
        } catch (Exception e) {
            //catch misuse
// Path: app/src/main/java/com/zulip/android/util/TypeSwapper.java
// public interface TypeSwapper<GIVEN, RETURN> {
//     RETURN convert(GIVEN given);
// 
// }
// 
// Path: app/src/main/java/com/zulip/android/util/ZLog.java
// public class ZLog {
// 
//     private ZLog() {
//     }
// 
//     public static void logException(Throwable e) {
//         if (!BuildHelper.shouldLogToCrashlytics()) {
//             Log.e("Error", "oops", e);
//         } else {
//             Crashlytics.logException(e);
//         }
//     }
// 
//     public static void log(String message) {
//         if (!BuildHelper.shouldLogToCrashlytics()) {
//             Log.e("Error", message);
//         } else {
//             Crashlytics.log(message);
//         }
//     }
// }


// Path: app/src/main/java/com/zulip/android/networking/response/events/GetEventResponse.java
import android.support.annotation.Nullable;
import com.google.gson.annotations.SerializedName;
import com.zulip.android.util.TypeSwapper;
import com.zulip.android.util.ZLog;
import java.util.ArrayList;
import java.util.List;

    private int handlerId;

    @SerializedName("events")
    private List<EventsBranch> events;

    @Nullable
    public <T> List<T> getEventsOf(EventsBranch.BranchType branchType) {
        return getEventsOf(branchType, null);
    }

    @Nullable
    public <T extends EventsBranch, R> List<R> getEventsOf(EventsBranch.BranchType branchType, TypeSwapper<T, R> converter) {
        if (events == null) {
            return null;
        }
        try {
            List<R> types = new ArrayList<>(events.size());
            for (int i = 0; i < events.size(); i++) {
                EventsBranch orig = events.get(i);
                if (orig.getClass().equals(branchType.getKlazz())) {
                    if (converter != null) {
                        types.add(converter.convert((T) orig));
                    } else {
                        types.add((R) orig);
                    }
                }
            }
            return types;
        } catch (Exception e) {
            //catch misuse
            ZLog.logException(e);