Good day !
Before asking a question I will describe my task (this can help with the answer).
There is an ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠ΅ . This image I break into a ΠΌΠ°ΡΡΠΈΡΡ images. And each element of the matrix is ββgenerated by code. In the following, I have to write each element to the database . Everything worked without streams and this pattern, just the recording speed was unsatisfactory. (used ΡΡΠ°Π½Π·Π°ΠΊΡΠΈΠΈ , ΡΠΈΠ½Π³Π»Π΅ΡΠΎΠ½ - ΠΊΠΎΠ½Π½Π΅ΠΊΡΠΎΡ , etc.)
I did everything according to this example.
In this example, he has the number of products made equal to the number of products taken. I.e:
Then he put these products 10 times
for (int i = 0; i < 10; i++) { cubbyhole.put(i); } And then he took them 10 times
for (int i = 0; i < 10; i++) { value = cubbyhole.get(); } In my case, the number of fabricated elements is n-Π½Π½ΠΎΠ΅ . Are there any ways to track the number of fabricated items? I try to make it so that each generated element is immediately recorded in the database .