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.database.Cursor;
import java.util.ArrayList;

public class Main {
    public static <T> ArrayList<T> cursorToList(Cursor cursor, Class<T> modelClass) {
        ArrayList<T> items = new ArrayList<T>();
        if (!isCursorEmpty(cursor)) {
            while (cursor.moveToNext()) {
                final T model = buildModel(modelClass, cursor);
                items.add(model);
            }
        }
        return items;
    }

    public static boolean isCursorEmpty(Cursor cursor) {
        return cursor == null || cursor.getCount() == 0;
    }

    private static <T> T buildModel(Class<T> modelClass, Cursor cursor) {
        T model = null;
        return model;
    }
}