title: Changing the sunflower app ViewModel to only show a list of plants?
body: <p>I am trying my best to use Google's sunflower app for the basis of my app, how would one change from the reliance on the variable "growZoneNumber" so that it only returns all plants?</p>
  
  <p>This is the java code as it stands from the person who converted it from googles official kotlin version:</p>
  
  <pre><code>package com.google.samples.apps.sunflower.viewmodels;
  
  import com.google.samples.apps.sunflower.data.Plant;
  import com.google.samples.apps.sunflower.data.PlantRepository;
  
  import java.util.List;
  
  import androidx.annotation.NonNull;
  import androidx.lifecycle.LiveData;
  import androidx.lifecycle.MutableLiveData;
  import androidx.lifecycle.Transformations;
  import androidx.lifecycle.ViewModel;
  
  /**
   * Created by Shawn Wang on 3/26/19.
   */
  public class PlantListViewModel extends ViewModel {
      private static final int NO_GROW_ZONE = -1;
  
      private PlantRepository plantRepository;
  
      private MutableLiveData&lt;Integer&gt; growZoneNumber;
  
      public LiveData&lt;List&lt;Plant&gt;&gt; plants;
  
      PlantListViewModel(@NonNull PlantRepository plantRepository) {
          super();
          this.plantRepository = plantRepository;
          this.growZoneNumber = new MutableLiveData&lt;&gt;(-1);
          this.plants = Transformations.switchMap(growZoneNumber, it -&gt; {
              if (it == NO_GROW_ZONE) {
                  return this.plantRepository.getPlants();
              } else {
                  return this.plantRepository.getPlantsWIthGrowZoneNumber(it);
              }
          });
      }
  
      public void setGrowZoneNumber(int num) {
          this.growZoneNumber.setValue(num);
      }
  
      public void cleanGrowZoneNumber() {
          this.growZoneNumber.setValue(NO_GROW_ZONE);
      }
  
      public boolean isFiltered() {
          return this.growZoneNumber.getValue() != NO_GROW_ZONE;
      }
  }
  </code></pre>
  
  <p>thanks.</p>