I was trying to insert Strings into StringBuffer using foreach method of parallelStream(), created from a Set collection.
The problem is every time I execute the code, the final String (StringBuffer.toString()) has 1 less element of the total (random element every time I try).

I also change the StringBuffer to StringBuilder, the parallelStream() to stream(), but always has 1 less element.

I am using: 
- Java version: java 1.8\_121
- Server: Weblogic 12.2.1.2 (I don't think this is relevant to the problem)
- Spring boot 2.0.2.RELEASE (I don't think this is relevant to the problem)

NOTE: I used a Map to keep the pdfs I should sign later on the process (in another HTTP request).

```java
Map<String, ClientPdf> dataToEncript = new HashMap<>(); // pdf name it will be the key for this map (it is unique in the sql query)

List<Client> listClients = // list of clients from database
Set<ClientPdf> clientsPdf = new HashSet<>();
for (Client client : listClients) { 
    clientsPdf.add(client.clientPdf()); // clientPdf() generate a new object ClientPdf, which is similar to Client class, but with less fields (essential for the Set)
}

log.debug("Generating documents");
clientsPdf.parallelStream().forEach(pdf -> {
    // some code to generate pdf

    log.debug("Inserting pdf: {}", pdf); // this log print, for example, 27.000 lines
    dataToEncript.put(pdf.getPdfName(), pdf);
});

StringBuffer sb = new StringBuffer(); // StringBuffer or StringBuilder, the same problem
for (ClientPdf clientPdf : dataToEncript.values()) {
    sb.append(clientPdf.getPdfName() + ";" + clientPdf.getRut() + "\n"); // appending all values of de map dataToEncript, it will append 26.669 (1 less)
}

```