How can I can sort a collection of objects using rxjava based on one or more fields of the objects?
public class Car {
public String model;
public int numberOfWheels;
public String color;
public int yearOfProduction;
}
List<Car> cars = new ArrayList<>();
cars.add(...);
cars.add(...);
Observable<List<Car>> getCars() { Observable.just(cars) };
Observable<List<Car>> getCarsSortedByModel() { ??? };
Observable<List<Car>> getCarsSortedByColor() { ??? };
Observable<List<Car>> getCarsSortedByModelAndColor() { ??? };
Observable.toSortedList
will returnObservable<List<Car>>
: