Source:
<code>public void getCampaigns() { if (view != null && mediaWikiApi != null) { if (this.campaign != null) { view.showCampaigns(campaign); return; } Single<CampaignResponseDTO> campaigns = mediaWikiApi.getCampaigns(); campaigns.observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribeWith(new SingleObserver<CampaignResponseDTO>() { @Override public void onSubscribe(Disposable d) { disposable = d; } @Override public void onSuccess(CampaignResponseDTO campaignResponseDTO) { List<Campaign> campaigns = campaignResponseDTO.getCampaigns(); <START> SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); <END> if (campaigns == null || campaigns.isEmpty()) { Log.e(TAG, "The campaigns list is empty"); view.showCampaigns(null); } Collections.sort(campaigns, (campaign, t1) -> { Date date1, date2; try { date1 = dateFormat.parse(campaign.getStartDate()); date2 = dateFormat.parse(t1.getStartDate()); } catch (ParseException e) { e.printStackTrace(); return -1; } return date1.compareTo(date2); }); Date campaignEndDate, campaignStartDate; Date currentDate = new Date(); try { for (Campaign aCampaign : campaigns) { campaignEndDate = dateFormat.parse(aCampaign.getEndDate()); campaignStartDate = dateFormat.parse(aCampaign.getStartDate()); if (campaignEndDate.compareTo(currentDate) >= 0 && campaignStartDate.compareTo(currentDate) <= 0) { campaign = aCampaign; break; } } } catch (ParseException e) { e.printStackTrace(); } view.showCampaigns(campaign); } @Override public void onError(Throwable e) { Log.e(TAG, "could not fetch campaigns: " + e.getMessage()); } }); } }</code><technical_language>undo this IMO fixing formatting properly instead of putting locale English</technical_language>

Target:
public void getCampaigns() { if (view != null && mediaWikiApi != null) { if (this.campaign != null) { view.showCampaigns(campaign); return; } Single<CampaignResponseDTO> campaigns = mediaWikiApi.getCampaigns(); campaigns.observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribeWith(new SingleObserver<CampaignResponseDTO>() { @Override public void onSubscribe(Disposable d) { disposable = d; } @Override public void onSuccess(CampaignResponseDTO campaignResponseDTO) { List<Campaign> campaigns = campaignResponseDTO.getCampaigns(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); if (campaigns == null || campaigns.isEmpty()) { Log.e(TAG, "The campaigns list is empty"); view.showCampaigns(null); } Collections.sort(campaigns, (campaign, t1) -> { Date date1, date2; try { date1 = dateFormat.parse(campaign.getStartDate()); date2 = dateFormat.parse(t1.getStartDate()); } catch (ParseException e) { e.printStackTrace(); return -1; } return date1.compareTo(date2); }); Date campaignEndDate, campaignStartDate; Date currentDate = new Date(); try { for (Campaign aCampaign : campaigns) { campaignEndDate = dateFormat.parse(aCampaign.getEndDate()); campaignStartDate = dateFormat.parse(aCampaign.getStartDate()); if (campaignEndDate.compareTo(currentDate) >= 0 && campaignStartDate.compareTo(currentDate) <= 0) { campaign = aCampaign; break; } } } catch (ParseException e) { e.printStackTrace(); } view.showCampaigns(campaign); } @Override public void onError(Throwable e) { Log.e(TAG, "could not fetch campaigns: " + e.getMessage()); } }); } }