Skip to content

Commit 2332937

Browse files
committed
rename newGrade method to generateNewGrade
1 parent 2c1ab04 commit 2332937

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/com/mongodb/Create.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public static void main(String[] args) {
3535

3636
private static void insertOneDocument(MongoCollection<Document> gradesCollection) {
3737
try {
38-
gradesCollection.insertOne(newGrade(10000d, 1d));
39-
System.out.println("One document inserted");
38+
gradesCollection.insertOne(generateNewGrade(10000d, 1d));
39+
System.out.println("One document inserted.");
4040
} catch (MongoException e) {
4141
e.printStackTrace();
4242
}
@@ -45,18 +45,18 @@ private static void insertOneDocument(MongoCollection<Document> gradesCollection
4545
private static void insertManyDocuments(MongoCollection<Document> gradesCollection) {
4646
List<Document> grades = new ArrayList<>();
4747
for (int classId = 1; classId <= 10; classId++) {
48-
grades.add(newGrade(10001d, classId));
48+
grades.add(generateNewGrade(10001d, classId));
4949
}
5050

5151
try {
5252
gradesCollection.insertMany(grades, new InsertManyOptions().ordered(false));
53-
System.out.println("Ten documents inserted");
53+
System.out.println("Ten documents inserted.");
5454
} catch (MongoException e) {
5555
e.printStackTrace();
5656
}
5757
}
5858

59-
private static Document newGrade(double studentId, double classId) {
59+
private static Document generateNewGrade(double studentId, double classId) {
6060
List<Document> scores = asList(new Document("type", "exam").append("score", rand.nextDouble() * 100),
6161
new Document("type", "quiz").append("score", rand.nextDouble() * 100),
6262
new Document("type", "homework").append("score", rand.nextDouble() * 100),

0 commit comments

Comments
 (0)