public static List<Restaurant> from(Cursor c){
  List<Restaurant> restaurants=null;
  while (c.moveToNext()) {
    Restaurant restaurant=new Restaurant();
    Syncing.from(c,restaurant);
    int col=c.getColumnIndex(PLACE_ID);
    if (col >= 0) {
      restaurant.placeId=c.getString(col);
    }
    if (TextUtils.isEmpty(restaurant.placeId)) {
      col=c.getColumnIndex(NAME);
      if (col >= 0) {
        restaurant.name=c.getString(col);
      }
      col=c.getColumnIndex(ADDRESS);
      if (col >= 0) {
        restaurant.address=c.getString(col);
      }
      col=c.getColumnIndex(INTL_PHONE);
      if (col >= 0) {
        restaurant.phone=c.getString(col);
      }
      col=c.getColumnIndex(URL);
      if (col >= 0) {
        restaurant.url=c.getString(col);
      }
    }
    col=c.getColumnIndex(NOTES);
    if (col >= 0) {
      restaurant.notes=c.getString(col);
    }
    col=c.getColumnIndex(GEOFENCE_NOTIFICATIONS);
    if (col >= 0) {
      restaurant.showGeofenceNotifications=c.getInt(col) == 1;
    }
    if (restaurants == null) {
      restaurants=new ArrayList<>(c.getCount());
    }
    restaurants.add(restaurant);
  }
  c.close();
  return restaurants;
}

public static List < Restaurant > from ( Cursor c ) { List < Restaurant > restaurants = null ; while ( c . moveToNext ( ) ) { Restaurant restaurant = new Restaurant ( ) ; Syncing . from ( c , restaurant ) ; int col = c . getColumnIndex ( PLACE_ID ) ; if ( col >= 0 ) { restaurant . placeId = c . getString ( col ) ; } if ( TextUtils . isEmpty ( restaurant . placeId ) ) { col = c . getColumnIndex ( NAME ) ; if ( col >= 0 ) { restaurant . name = c . getString ( col ) ; } col = c . getColumnIndex ( ADDRESS ) ; if ( col >= 0 ) { restaurant . address = c . getString ( col ) ; } col = c . getColumnIndex ( INTL_PHONE ) ; if ( col >= 0 ) { restaurant . phone = c . getString ( col ) ; } col = c . getColumnIndex ( URL ) ; if ( col >= 0 ) { restaurant . url = c . getString ( col ) ; } } col = c . getColumnIndex ( NOTES ) ; if ( col >= 0 ) { restaurant . notes = c . getString ( col ) ; } col = c . getColumnIndex ( GEOFENCE_NOTIFICATIONS ) ; if ( col >= 0 ) { restaurant . showGeofenceNotifications = c . getInt ( col ) == 1 ; } if ( restaurants == null ) { restaurants = new ArrayList < > ( c . getCount ( ) ) ; } restaurants . add ( restaurant ) ; } c . close ( ) ; return restaurants ; }
get restaurants from the cursor and then close it .
