public PieData findMostPlayedData(StatisticType type,List<Long> shownChallenges){
  ArrayList<Entry> entries=new ArrayList<>();
  ArrayList<String> labels=new ArrayList<>();
  List<Statistics> statistics;
  statistics=mStatisticsDataSource.findByCategoryAndUser(mCategoryId,mUser);
switch (type) {
case TYPE_MOST_PLAYED:
    break;
case TYPE_MOST_FAILED:
  statistics=removeSucceeded(statistics);
break;
case TYPE_MOST_SUCCEEDED:
statistics=removeFailed(statistics);
break;
default :
return null;
}
shownChallenges.addAll(getMost(entries,labels,statistics,NUMBER_PLAYED_LISTED));
if (entries.size() > 1) {
PieDataSet dataset=new PieDataSet(entries,"");
mSettings.applyDataSetSettings(dataset,type);
PieData data=new PieData(labels,dataset);
mSettings.applyDataSettings(data);
return data;
}
 else {
return null;
}
}

public PieData findMostPlayedData ( StatisticType type , List < Long > shownChallenges ) { ArrayList < Entry > entries = new ArrayList < > ( ) ; ArrayList < String > labels = new ArrayList < > ( ) ; List < Statistics > statistics ; statistics = mStatisticsDataSource . findByCategoryAndUser ( mCategoryId , mUser ) ; switch ( type ) { case TYPE_MOST_PLAYED : break ; case TYPE_MOST_FAILED : statistics = removeSucceeded ( statistics ) ; break ; case TYPE_MOST_SUCCEEDED : statistics = removeFailed ( statistics ) ; break ; default : return null ; } shownChallenges . addAll ( getMost ( entries , labels , statistics , NUMBER_PLAYED_LISTED ) ) ; if ( entries . size ( ) > 1 ) { PieDataSet dataset = new PieDataSet ( entries , "" ) ; mSettings . applyDataSetSettings ( dataset , type ) ; PieData data = new PieData ( labels , dataset ) ; mSettings . applyDataSettings ( data ) ; return data ; } else { return null ; } }
creates a piedata object containing entries of the most played / failed or succeded challenges . which of these entries are added depends on the given mode . the ids of the challenges are also added to the shownchallenges list .
