Stream through a portion of a 2D array in Java
Let's say you have a matrix
[[1,2,5],[3,4,6]] and you need to work with the first two elements of each row together [1,2,3,4]. You don't want to store this in memory or use nested loops. Is there a way to achieve this using streams in Java?