158. Introducing the slice handle
Let’s suppose that we have the following nested model (10 sequences of 5 double values each):
SequenceLayout innerSeq
  = MemoryLayout.sequenceLayout(5, ValueLayout.JAVA_DOUBLE);
SequenceLayout outerSeq
  = MemoryLayout.sequenceLayout(10, innerSeq);
    Next, we define a VarHandle via PathElement and we populate this model accordingly with some random data:
VarHandle handle = outerSeq.varHandle(
  PathElement.sequenceElement(),
  PathElement.sequenceElement());
try (Arena arena = Arena.ofConfined()) {
  MemorySegment segment = arena.allocate(outerSeq);
  for (int i = 0; i < outerSeq.elementCount(); i++) {
    for (int j = 0; j < innerSeq.elementCount(); j++) {
      handle.set(segment, i, j, Math.random());
    }
  }
}
    OK, you should be familiar with this code, so nothing new so far. Next, we plan to extract from this model the third sequence from 10 containing 5 sequences of double values. We can accomplish this via the...