Skip to content

Commit

Permalink
Changing stocks from List to ArrayList
Browse files Browse the repository at this point in the history
  • Loading branch information
martin committed Mar 6, 2026
1 parent 60d3872 commit 945cc6c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/millions/Stock.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package millions;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Stock {
Expand All @@ -11,13 +12,13 @@ public class Stock {
public Stock(String symbol, String company, List<BigDecimal> prices) {
this.symbol = symbol;
this.company = company;
this.prices = prices;
this.prices = new ArrayList<>(prices);
}

public Stock(String symbol, String company, BigDecimal initialPrice) {
this.symbol = symbol;
this.company = company;
this.prices = List.of(initialPrice);
this.prices = new ArrayList<>(List.of(initialPrice));
}

public String getSymbol() {
Expand Down

0 comments on commit 945cc6c

Please sign in to comment.