The content in a file is not always received in a way that means it can be processed immediately and will require some additional steps so that it can be prepared for processing. Typically, we need to tokenize the file and extract information from different data structures (arrays, lists, maps, and so on).
For example, let's consider a file, clothes.txt:
Path path = Paths.get("clothes.txt");
Its content is as follows:
Top|white\10/XXL&Swimsuit|black\5/LCoat|red\11/M&Golden Jacket|yellow\12/XLDenim|Blue\22/M
This file contains some clothing articles and their details separated by the & character. A single article is represented as follows:
article name | color \ no. available items / size
Here, we have several ...