<commit_before>package com.petar.weather.ui.adapter;

import android.databinding.DataBindingUtil;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.petar.weather.BR;
import com.petar.weather.R;
import com.petar.weather.databinding.ForecastBinding;
import com.petar.weather.logic.models.AForecast;

import java.util.List;

/**
 * Created by User on 23.6.2017 г..
 */

public class ForecastRecyclerAdapter extends RecyclerView.Adapter<ForecastRecyclerAdapter.BindingHolder> {
    private List<? extends AForecast> mForecasts;

    public ForecastRecyclerAdapter(List<? extends AForecast> forecasts) {
        mForecasts = forecasts;
    }

    @Override
    public BindingHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.forecast, parent, false);
        return new BindingHolder(view);
    }

    @Override
    public void onBindViewHolder(BindingHolder holder, int position) {
        final AForecast forecast = mForecasts.get(position);
        holder.getBinding().setVariable(BR.item, forecast);
        holder.getBinding().executePendingBindings();
    }

    @Override
    public int getItemCount() {
        return mForecasts.size();
    }

    public static class BindingHolder extends RecyclerView.ViewHolder {
        private ForecastBinding mBinding;

        public BindingHolder(View itemView) {
            super(itemView);
            mBinding = DataBindingUtil.bind(itemView);
        }

        public ForecastBinding getBinding() {
            return mBinding;
        }
    }
}<commit_msg>[CHANGE] The ForecastRecyclerAdapter is not initialized with the forecasts, because the data might be missing. Helpers are provided to set the data when the location and forecasts are available<commit_after>package com.petar.weather.ui.adapter;

import android.databinding.DataBindingUtil;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.petar.weather.BR;
import com.petar.weather.R;
import com.petar.weather.databinding.ForecastBinding;
import com.petar.weather.logic.models.AForecast;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by User on 23.6.2017 г..
 */

public class ForecastRecyclerAdapter extends RecyclerView.Adapter<ForecastRecyclerAdapter.BindingHolder> {
    private List<? extends AForecast> mData;

    public ForecastRecyclerAdapter() {
        mData = new ArrayList<>();
    }

    @Override
    public BindingHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.forecast, parent, false);
        return new BindingHolder(view);
    }

    @Override
    public void onBindViewHolder(BindingHolder holder, int position) {
        final AForecast forecast = mData.get(position);
        holder.getBinding().setVariable(BR.item, forecast);
        holder.getBinding().executePendingBindings();
    }

    @Override
    public int getItemCount() {
        return mData.size();
    }

    public void setData(List<? extends AForecast> data) {
        mData = data;
        notifyDataSetChanged();
    }

    public static class BindingHolder extends RecyclerView.ViewHolder {
        private ForecastBinding mBinding;

        public BindingHolder(View itemView) {
            super(itemView);
            mBinding = DataBindingUtil.bind(itemView);
        }

        public ForecastBinding getBinding() {
            return mBinding;
        }
    }
}
{'fraction_non_alphanumeric': 0.09090909090909091, 'fraction_numerical': 0.004354926510615134, 'mean_word_length': 3.4437726723095525, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6818573', 'n_tokens_mistral': 1075, 'n_tokens_neox': 998, 'n_words': 237}