We have a complex class containing Collection. Every object of this class should be written into file. Is there an efficient way to update the data of the files, instead of rewriting the whole content of the file. Example:
ArrayList<String> arr = new ArrayList<>();
arr.add("foo");
arr.add("bar");
Gson gson = new Gson();
System.out.println(gson.toJson(arr));
arr.add("baz");
System.out.println(gson.toJson(arr));
Output:
["foo","bar"]
["foo","bar","baz"]