private Publisher<?> query(StandardOperations.Select select) {
      final Query query = select.query();
      if (query.hasAggregations()) {
        throw new UnsupportedOperationException("Aggregations are not yet supported by " + InMemoryBackend.class.getSimpleName());
      }
      Stream<Object> stream = store.values().stream();

      // filter
      if (query.filter().isPresent()) {
        Predicate<Object> predicate = ExpressionInterpreter.of(query.filter().get()).asPredicate();
        stream = stream.filter(predicate);
      }

      // sort
      if (!query.collations().isEmpty()) {
        Comparator<Object> comparator = null;
        for (Collation collation: query.collations()) {
          Function<Object, Comparable<Object>> fn = obj -> (Comparable<Object>) pathExtractor.extract(collation.path(), obj);
          @SuppressWarnings("unchecked")
          Comparator<Object> newComparator = Comparator.<Object, Comparable>comparing(fn);
          if (!collation.direction().isAscending()) {
            newComparator = newComparator.reversed();
          }

          if (comparator != null) {
            comparator = comparator.thenComparing(newComparator);
          } else {
            comparator = newComparator;
          }
        }

        stream = stream.sorted(comparator);
      }

      if (query.hasProjections()) {
        final TupleExtractor extractor = new TupleExtractor(query, pathExtractor);
        stream = stream.map(extractor::extract);
      }

      if (query.distinct()) {
        stream = stream.distinct();
      }

      if (query.offset().isPresent()) {
        stream = stream.skip(query.offset().getAsLong());
      }

      if (query.limit().isPresent()) {
        stream = stream.limit(query.limit().getAsLong());
      }

      if (query.count()) {
        // just return count
        return Flowable.just(stream.count());
      }

      return Flowable.fromIterable(stream.collect(Collectors.toList()));
    }
mapping between class and its store
criteria/inmemory/src/org/immutables/criteria/inmemory/InMemoryBackend.java