private synchronized ByteBuffer getOrCreateSegment(int index) {
    while (segments.size() <= index) {
      segments.add(null);
    }
    if (segments.get(index) == null) {
      numSegments.incrementAndGet();
      segments.set(index, direct ? ByteBuffer.allocateDirect(segmentSize) : ByteBuffer.allocate(segmentSize));
    }
    return segments.get(index);
  }
A map from sequential {@code long} keys to {@code long} values backed by {@link ByteBuffer ByteBuffers} segments
in-memory where key defines the segment and offset into that segment.
planetiler-core/src/main/java/com/onthegomap/planetiler/collection/ArrayLongLongMapRam.java