title: Java Storing data locally on my pc without using a DB Preferably in .txt file (like C#'s StreamReader and Writer)
body: <p>First some Background: <br>
  I'm building my own music application, the application scans the entire operating system for all audio files,
  all audio files in the same directory have their own playlist. and standard there is also 1 big playlist containing all the audio files on the operating system.</p>
  <p>This data doesn't need to be stored anywhere because it is done by default by the operating system, which audio files are in which directory with which path etc.</p>
  <p>(This application is just for myself and after successfully making it on my pc I want to learn android development and make it for my phone.)</p>
  <p>The thing I am struggling with is the fact that the user can also create their own playlist selecting any song they want. After creating the playlist and adding songs, it should naturally not be deleted when the user quits the application and later restarts it. I don't want to use a DB because I will be using the application myself and don't want to host a database for it.</p>
  <p>I was first thinking on storing the data in .txt file like StreamReader and Writer for C#. But I don't think this is the best solution.</p>
  <p>In my application the Songs are stored like this.</p>
  <pre><code>public class Song() {
    name (String);
    path (String);
  }
  
  public class Artist {
     name (String);
  }
  
  public class ArtistSong {
     song (Object class: Song);
     Artists (Arraylist class: Artist); //Songs can have multiple artists.
  }
  
  public class Playlist {
    name (String);
    songs (Arraylist class: ArtistSong);
  }
  </code></pre>
  <p>When Retrieving all songs from the pc and creating 1main playlist (all audio files) and a playlist per directory in which the audio file are stored. I make 1 big arraylist type: ArtistSongs. containing all songs.
  And a number of other ArrayLists (for each playlist per directory. These array referenece the big arraylist with all songs in it.)</p>
  <p>I don't mind the process of retrieving each song (and creating per directory the arraylists for each playlist) each time the application is started.</p>
  <h2>--
  Now when the user creates their own playlist</h2>
  <pre><code>//This is done dynamically. when the user clicks on create new playlist and selects songs for it.
  ArrayList&lt;ArtistSong&gt; songsForPlaylist = new ArrayList&lt;&gt;();
  String nameForPlaylist=&quot;playlist_1&quot;:
  songsForPlaylist.add(song1);
  songsForPlaylist.add(song2); // song1,2 reference to the 1big arraylist earlier created type: object of ArtistSong
  
  Playlist play = new PlayList(songsForPlaylist,nameForPlayList);
  </code></pre>
  <p>So now the playlist is created, and being stored in the Object 'play'. This works as long as the application is running.</p>
  <p>Now for storing all I need to store is:<br>
  -&gt;Full path to audio file with name<br>
  -&gt;playlistname (this name is unique).<br>
  The artists and songname I can extract from the full path and name.</p>
  <p>F.E.<br>
  C:/users/niels/songs/artist1 - Song1<br>
  C:/users/niels/songs/artist2 - Song2<br>
  C:/users/niels/songs/artist3, artist4 - Song3<br></p>
  <p>What I would like to store somewhere is (The way is has to be stored may be different if you can think of a more efficient way)<br></p>
  <pre><code>.txt file:
  playlist1 #$# C:/users/niels/songs/artist1 - Song1&lt;br&gt;
  playlist1 #$# C:/users/niels/songs/artist2 - Song2&lt;br&gt;
  playlist2 #$# C:/users/niels/songs/artist3, artist4 - Song3&lt;br&gt;
  </code></pre>
  <p>This way I stored 3 songs in 2 playlist, i'm using #$# as a separater. And with storing it like this I can on the startup of my application I can create the extra playlist on the basis of this txt file.
  Also an important note if I will be doing it this way each line of the txt file will only containt 1song with the unique playlistname. The application will have to read the .txt file line per line just like in C#.</p>
  <p>How would I achieve something like this in Java?
  Or should I even store it this way? And if not what would be a better way?</p>