save scores to file

This commit is contained in:
PawelJa 2019-05-27 19:15:45 +01:00
parent 6eed415262
commit 444dec7085
2 changed files with 14 additions and 5 deletions

View File

@ -74,7 +74,7 @@ public class Main {
}
private static void removeObjectsContainedNull() {
scoreList = scoreList.stream().filter( x ->
scoreList = scoreList.stream().filter(x ->
x.getScore() != null &&
x.getDescription() != null &&
x.getAdvantagesCounter() != null &&
@ -91,8 +91,11 @@ public class Main {
}
PrintWriter printWriter = new PrintWriter(fileWriter);
for(Score score: scoreList) {
printWriter.printf(score.toString());
for (Score score : scoreList) {
try {
printWriter.printf(score.toString());
} catch (Exception e) {
}
}
printWriter.close();
@ -100,7 +103,13 @@ public class Main {
public static void main(String[] args) throws IOException {
int[] productList = new int[]{70021762, 26740026};
int[] productList = new int[]{
56521840, 56521838, 59096052, 29362313, 40271605, 37626779, 36068160,
26740026, 32868829, 27833954, 63619548, 58705201, 58705199, 10201710,
49525768, 50537053, 39644137, 45238398, 63771190, 47933860, 29362313,
39082735, 52404834, 59123369, 28674240, 41546872, 52874995, 40271605,
37626779, 40546569, 26740026, 24564895, 30176677, 13008310, 47524311,
52316458, 11380153, 32625236, 26210836, 40546570, 47484912, 37588133};
for (Integer item : productList) {
getScoresByItemId(item);
}

View File

@ -48,7 +48,7 @@ public class Score {
@Override
public String toString() {
return score +
";;;;;" + description + '\'' +
";;;;;" + description +
";;;;;" + advantagesCounter +
";;;;;" + dissadvantagesCounter + "\n";
}