title: Can't realize RecycleAdapter to custom ArrayList to get random query result on database
body: <p>I have a database in <code>Firestore</code> and <code>RecycleView</code> to put the data from it. I send some query to <code>Firestore</code> and it get me the result depending on my request. But what, if I want to take 3 random results from the set issued to me on request. That is I get, for example, 20 results and want to take only 3 result each time when I send a request. And each time, it must be random 3 results from this 20? </p>
  
  <p>I was helped to implement the mechanism of selection of 3 random results into the code, but I do not understand how to connect it to my <code>adapter</code>.</p>
  
  <pre><code>    public class Myactivity extends AppCompatActivity {
  
      public RecyclerView mResultList;
      public FirebaseFirestore mFirestore;
      public com.google.firebase.firestore.Query query;
      public FirestoreRecyclerAdapter&lt;Places, PlaceViewHolder&gt; firestoreRecyclerAdapter;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_recycle_activity);
          mResultList = findViewById(R.id.list_result);
  
          Boolean l_check1 = getIntent().getExtras().getBoolean("1");
          Boolean l_check2 = getIntent().getExtras().getBoolean("2");
          Boolean l_check3 = getIntent().getExtras().getBoolean("3");
          mFirestore = FirebaseFirestore.getInstance();  
          if (l_check1) {
              query = mFirestore.collection("Places").whereEqualTo("colour", "1").limit(20);
              query.get().addOnCompleteListener(new OnCompleteListener&lt;QuerySnapshot&gt;() {
              @Override
              public void onComplete(@NonNull Task&lt;QuerySnapshot&gt; task) {
                  if (task.isSuccessful()) {
                      List&lt;Places&gt; placesList = new ArrayList&lt;&gt;();
                      for (DocumentSnapshot document : task.getResult()) {
                          Places place = document.toObject(Places.class);
                          placesList.add(place);
                      }
                      int placeCount = placesList.size();
                      int randomNumber = new Random().nextInt(placeCount);
  
                      List&lt;Places&gt; randomPlaceList = new ArrayList&lt;&gt;();
                      for (int i=1; i&lt;=3; i++) {
                          randomPlaceList.add(placesList.get(randomNumber));
                      }
                  }
              }
          });
          } else if (l_check2) {
              query = mFirestore.collection("Places").whereEqualTo("colour", "2").limit(3);
          } else if (l_check3) {
              query = mFirestore.collection("Places").whereEqualTo("colour", "3").limit(3);
          }
          mResultList.setLayoutManager(new LinearLayoutManager(this));
          FirestoreRecyclerOptions&lt;Places&gt; options = new FirestoreRecyclerOptions.Builder&lt;Places&gt;()
                  .setQuery(query, Places.class)
                  .build();
          firestoreRecyclerAdapter = new FirestoreRecyclerAdapter&lt;Places, PlaceViewHolder&gt;(options) {
              @Override
              protected void onBindViewHolder(PlaceViewHolder holder, int position, Places model) {
  
                  holder.setDetails(getApplicationContext(), model.getName(), model.getImage());
              }
  
              @Override
              public PlaceViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
                  View view = LayoutInflater.from(parent.getContext())
                          .inflate(R.layout.list_layout, parent, false);
                  return new PlaceViewHolder(view);
              }
  
          };
          mResultList.setAdapter(firestoreRecyclerAdapter);
      }
      @Override
      protected void onStart() {
          super.onStart();
          firestoreRecyclerAdapter.startListening();
      }
      class PlaceViewHolder extends RecyclerView.ViewHolder {
  
          View mView;
  
          public PlaceViewHolder(View itemView) {
              super(itemView);
  
              mView = itemView;
          }
  
          public void setDetails(Context context, String placeName, String placeImage) {
  
              final TextView place_Name = mView.findViewById(R.id.text_image_id);
              ImageView place_Image = mView.findViewById(R.id.image_id);
  
              place_Name.setText(placeName);
              Glide.with(context).load(placeImage).into(place_Image);
  
              place_Name.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      Intent intent = new Intent(getApplicationContext(), Card_activity.class);
                      intent.putExtra("qwerty", place_Name.getText());
                      startActivity(intent);
                  }
              });
          }
      }
      @Override
      protected void onStop() {
          super.onStop();
          if (firestoreRecyclerAdapter != null) {
              firestoreRecyclerAdapter.stopListening();
          }
      }
  }
  </code></pre>
  
  <p>My Place.class:</p>
  
  <pre><code>public class Places {
  private String image, name;
  public Places() { }
  
  public Places(String image, String name) {
      this.image = image;
      this.name = name; 
  }
  public String getImage() { return image; }
  public String getName() { return name; }   
  }
  </code></pre>