Skip to content

refactor classes according to checkstyle #62

Merged
merged 1 commit into from
Apr 9, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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