Tag Archives: collections

Is it possible to replace nested loops on different collections with Stream API

Questions: I was wondering if it’s possible to rewrite nested for loops using java.utils.stream in Java 8? Here is a sample data type I’m working with: class Folder { private final String name; private final Integer itemCound; Folder(String name, Integer itemCount) { this.name = name; this.itemCount = itemCount; } public String getName() { return this.name;… Read More »

Does ASP.NET Core WebAPI not support deferred execution / lazy evaluation when returning collections?

Questions: I’ve just run into what I’d consider a slightly odd bit of behaviour when writing a C# ASP.NET Core WebAPI controller. Consider the following controller method, which accepts a JSON body and produces an XML output (for reasons I won’t go into): [Produces(“application/xml”)] [Route(“api/route/to/data”] [HttpPost] public IActionResult GetData([FromBody]IEnumerable<InputData> inputs) { return HandleResponse(() => _repository.GetData(inputs));… Read More »