This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Testing Preferences | |
| Use AssertJ assertions instead of JUnit assertions for all test cases | |
| Example: | |
| javaCopy// Preferred (AssertJ): | |
| assertThat(actual).isEqualTo(expected); | |
| // Instead of (JUnit): | |
| assertEquals(expected, actual); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.math.BigDecimal; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| import java.util.Map; | |
| import java.util.stream.Collectors; | |
| public class StudentAggregation { | |
| public record Student(String department, String name, String gender, BigDecimal height, BigDecimal weight) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.math.BigDecimal; | |
| public static FinancePortfolio optimizePortfolio(Map<String, Position> positions, | |
| Map<String, ModelPosition> modelPositions, | |
| Map<String, Restriction> restrictedTickers, | |
| BasicMatrix constraintMatrix) { | |
| int numAssets = positions.size(); | |
| int numUnrestrictedAssets = (int) positions.keySet().stream() | |
| .filter(ticker -> restrictedTickers.getOrDefault(ticker, Restriction.NONE) != Restriction.BOTH) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dependencyManagement> | |
| <dependencies> | |
| <dependency> | |
| <groupId>org.openrewrite.recipe</groupId> | |
| <artifactId>rewrite-recipe-bom</artifactId> | |
| <version>1.17.0</version> | |
| <scope>import</scope> | |
| <type>bom</type> | |
| </dependency> | |
| </dependencies> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. The collectWhile output is a bit misleading. The slice of size 3. However, the slice is shows all elements. Any comments | |
| Chunk (9, 2, 5, 1, 6).collectWhile { | |
| case element if element >= 2 => element * element | |
| } | |
| res25: Chunk[Int] = Slice(Arr(Array(81, 4, 25, 0, 0)), 0, 3) | |
| Answer: Looks like Ammonite issue... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package net.ziem | |
| import zio.ZLayer | |
| import zio.clock.Clock | |
| import zio.duration._ | |
| import zio.Has | |
| import zio.IO | |
| import zio.Queue | |
| import zio.Ref | |
| import zio.UIO |