Skip to content

Commit

Permalink
Issue jcabi#952 - improvements for MkNotifications initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
prondzyn committed Oct 2, 2015
1 parent b318031 commit c8c6e26
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/main/java/com/jcabi/github/mock/MkNotifications.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import com.jcabi.github.GitHubThread;
import com.jcabi.github.Notification;
import com.jcabi.github.Notifications;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.NotImplementedException;

Expand All @@ -60,15 +60,13 @@ final class MkNotifications implements Notifications {
/**
* Public ctor.
* @param quantity Number of notifications.
* @checkstyle InnerAssignmentCheck (7 lines)
*/
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
MkNotifications(final int quantity) {
int identifier = 0;
this.notifications = Collections
.<Notification>nCopies(
quantity,
new MkNotification(identifier += 1)
);
this.notifications = new ArrayList<Notification>(quantity);
for (int index = 0; index < quantity; index += 1) {
this.notifications.add(index, new MkNotification(index));
}
}

@Override
Expand Down

0 comments on commit c8c6e26

Please sign in to comment.