Skip to content

Commit

Permalink
refactor classes according to checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
einaskoi committed Mar 27, 2026
1 parent 4ea21f9 commit d137159
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
14 changes: 10 additions & 4 deletions src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Exchange.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ public void advance() {
* @return a list of stocks sorted by price change
*/
public List<Stock> getGainers(int limit) {
return stockMap.values().stream().sorted((a, b) -> b.getLatestPriceChange()
.compareTo(a.getLatestPriceChange())).limit(limit).toList();
return stockMap.values().stream()
.sorted((a, b) -> b.getLatestPriceChange()
.compareTo(a.getLatestPriceChange()))
.limit(limit)
.toList();
}

/**
Expand All @@ -147,7 +150,10 @@ public List<Stock> getGainers(int limit) {
* @return a list of stocks sorted by price change
*/
public List<Stock> getLosers(int limit) {
return stockMap.values().stream().sorted((a, b) -> a.getLatestPriceChange()
.compareTo(b.getLatestPriceChange())).limit(limit).toList();
return stockMap.values().stream()
.sorted((a, b) -> a.getLatestPriceChange()
.compareTo(b.getLatestPriceChange()))
.limit(limit)
.toList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,9 @@ public Status getStatus() {

if (isSpeculator) {
return Status.SPECULATOR;
}
else if (isInvestor) {
} else if (isInvestor) {
return Status.INVESTOR;
}
else {
} else {
return Status.NOVICE;
}
}
Expand Down

0 comments on commit d137159

Please sign in to comment.