0

want to iterate thru bidChoices list and map using scala, below is the java code. what to perform the same using scala.

private String generateRestBody(String baseUrl, String auctionId, String baseAuctionId, List<String> bidChoices) {
        return BODY_TEMPLATE.formatted(
                DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(OffsetDateTime.now()),
                bidChoices.stream()
                        .map(slotNo -> SELECTION_URI_TEMPLATE.formatted(BASE_URL, AUCTION_ID, BASE_AUCTION_ID, slotNo))
                        .collect(Collectors.joining(","))).replaceAll("\n", "");
    }
Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66
Banu
  • 37
  • 6
  • 3
    What did you try so far? What issues did you get? – Gaël J Feb 09 '23 at 18:35
  • In Scala there are different flavors of streams: deprecated `Stream`, `LazyList`, fs2, akka-stream etc. Also Java code can be written in Scala. – Dmytro Mitin Feb 09 '23 at 18:40
  • https://stackoverflow.com/questions/38339440/how-to-convert-a-java-stream-to-a-scala-stream https://stackoverflow.com/questions/38486886/convert-java-util-stream-stream-to-scala-stream – Dmytro Mitin Feb 09 '23 at 18:43

0 Answers0