Skip to content

Commit

Permalink
chore: Sonar fixes (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
gazbert committed Nov 14, 2024
1 parent e0e976d commit 64dd7fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
Expand Down Expand Up @@ -79,7 +78,7 @@ public MarketConfig findById(String id) {
marketsType.getMarkets().stream()
.filter(item -> item.getId().equals(id))
.distinct()
.collect(Collectors.toList()));
.toList());
}

@Override
Expand Down Expand Up @@ -130,7 +129,7 @@ public MarketConfig save(MarketConfig config) {
updatedMarketsType.getMarkets().stream()
.filter(item -> item.getId().equals(config.getId()))
.distinct()
.collect(Collectors.toList()));
.toList());
} else {
log.warn(
"Trying to update MarketConfig but id does not exist MarketConfig: {}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
Expand Down Expand Up @@ -77,7 +76,7 @@ public StrategyConfig findById(String id) {
strategiesType.getStrategies().stream()
.filter(item -> item.getId().equals(id))
.distinct()
.collect(Collectors.toList()));
.toList());
}

@Override
Expand Down Expand Up @@ -129,13 +128,13 @@ public StrategyConfig save(StrategyConfig config) {
updatedStrategiesType.getStrategies().stream()
.filter(item -> item.getId().equals(config.getId()))
.distinct()
.collect(Collectors.toList()));
.toList());
} else {
log.warn(
"Trying to update StrategyConfig but id does not exist StrategyConfig: "
+ config
+ " Existing StrategyConfig: "
+ strategiesType.getStrategies());
+ "{} Existing StrategyConfig: {}",
config,
strategiesType.getStrategies());
return null;
}
}
Expand Down Expand Up @@ -163,9 +162,9 @@ public StrategyConfig delete(String id) {
} else {
log.warn(
"Trying to delete StrategyConfig but id does not exist. StrategyConfig id: "
+ id
+ " Existing StrategyConfig: "
+ strategiesType.getStrategies());
+ "{} Existing StrategyConfig: {}",
id,
strategiesType.getStrategies());
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import lombok.extern.log4j.Log4j2;
Expand Down Expand Up @@ -152,14 +151,14 @@ List<String> getTailLines() {
// Truncates the file head if file line count > maxLines
return IntStream.range(offset < maxLines ? 0 : offset - maxLines, offset)
.mapToObj(idx -> lines[idx % maxLines])
.collect(Collectors.toList());
.toList();
}

List<String> getHeadLines() {
// Truncates the file tail if file line count > maxLines
return IntStream.range(0, maxLines > offset ? offset : maxLines)
.mapToObj(idx -> lines[idx % maxLines])
.collect(Collectors.toList());
.toList();
}
}
}

0 comments on commit 64dd7fb

Please sign in to comment.