Skip to content

Commit

Permalink
Adding GetShares to Portfolio
Browse files Browse the repository at this point in the history
  • Loading branch information
martin committed Mar 5, 2026
1 parent 74507e4 commit ec4cf02
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/temppackage/Portfolio.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public List<Share> getShares() {
return this.shares;
}

public List<Share> getShares(String symbol) {
return this.shares.stream()
.filter(share -> share.getStock().getSymbol().equals(symbol))
.toList();
}

public boolean contains(Share share) {
return this.shares.contains(share);
}
Expand Down

0 comments on commit ec4cf02

Please sign in to comment.