<commit_before>package com.alexstyl.specialdates.people

import com.alexstyl.specialdates.contact.ContactsProvider
import io.reactivex.Observable
import io.reactivex.Scheduler
import io.reactivex.disposables.Disposable
import io.reactivex.subjects.PublishSubject

class PeoplePresenter(
        private val contactProvider: ContactsProvider,
        private val workScheduler: Scheduler,
        private val resultScheduler: Scheduler) {

    private val subject = PublishSubject.create<Int>()
    private var disposable: Disposable? = null

    fun startPresentingInto(view: PeopleView) {
        disposable =
                Observable.fromCallable {
                    contactProvider.allContacts
                }
                        .observeOn(workScheduler)
                        .map { contacts ->
                            val viewModels = arrayListOf<PeopleViewModel>()
                            contacts.forEach { contact ->
                                viewModels.add(PeopleViewModel(contact,
                                        contact.displayName.toString(),
                                        contact.imagePath,
                                        contact.contactID,
                                        contact.source))
                            }
                            viewModels
                        }
                        .observeOn(resultScheduler)
                        .subscribe { viewModels ->
                            view.displayPeople(viewModels)
                        }


    }

    fun stopPresenting() {
        disposable?.dispose()
    }
}

<commit_msg>Sort contacts according to their names<commit_after>package com.alexstyl.specialdates.people

import com.alexstyl.specialdates.contact.ContactsProvider
import io.reactivex.Observable
import io.reactivex.Scheduler
import io.reactivex.disposables.Disposable

class PeoplePresenter(
        private val contactProvider: ContactsProvider,
        private val workScheduler: Scheduler,
        private val resultScheduler: Scheduler) {

    private var disposable: Disposable? = null

    fun startPresentingInto(view: PeopleView) {
        disposable =
                Observable.fromCallable {
                    contactProvider.allContacts
                }
                        .observeOn(workScheduler)
                        .map { contacts ->
                            val viewModels = arrayListOf<PeopleViewModel>()
                            contacts.forEach { contact ->
                                viewModels.add(PeopleViewModel(contact,
                                        contact.displayName.toString(),
                                        contact.imagePath,
                                        contact.contactID,
                                        contact.source))
                            }
                            viewModels.sortedWith(compareBy({ it.personName }))
                        }
                        .observeOn(resultScheduler)
                        .subscribe { viewModels ->
                            view.displayPeople(viewModels)
                        }


    }

    fun stopPresenting() {
        disposable?.dispose()
    }
}


{'fraction_non_alphanumeric': 0.06209453197405004, 'fraction_numerical': 0.0, 'mean_word_length': 1.2595952547103977, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2017821', 'n_tokens_mistral': 711, 'n_tokens_neox': 663, 'n_words': 124}