title: What is a Cursor and what does it do (in this case)?
body: <p>I have to understand some java code from android studio, but as I'm new to both Java and android I have a question.</p>
  
  <p>Anyone know what Cursor actually is and what does it do exactly in this case?</p>
  
  <pre><code>private Movie cursorToMovie (Cursor cursor)
      {
          Movie movie = new Movie();
          movie.setId(cursor.getInt(0));
          movie.setName(cursor.getString(1));
          movie.setGenre(cursor.getString(2));
          movie.setYear(cursor.getInt(3));
          movie.setSynopsis(cursor.getString(4));
  
          return movie;
      }
  
  
      public List&lt;Movie&gt; getAllMovies()
      {
          open();
  
          List&lt;Movie&gt; movieList = new ArrayList&lt;&gt;();
  
          Cursor cursor = db.query(Movie.TABLE_NAME, MovieAllColumns, null, null, null, null, null);
          cursor.moveToFirst();
  
          while (!cursor.isAfterLast())
          {
              Movie movie = cursorToMovie(cursor);
              movieList.add(movie);
              cursor.moveToNext();
          }
  
          cursor.close();
          close();
          return movieList;
  
      }
  </code></pre>