Source:
<code>public GenericIndexed<T>.BufferIndexed singleThreaded() { final ByteBuffer copyHeaderBuffer = headerBuffer.asReadOnlyBuffer(); if (valueBuffers.size() == 1) { final ByteBuffer copyBuffer = valueBuffers.get(0).asReadOnlyBuffer(); return new BufferIndexed() { @Override public T get(final int index) { if (index < 0) { throw new IAE("Index[%s] < 0", index); } if (index >= size) { throw new IAE(String.format("Index[%s] >= size[%s]", index, size)); } final int startOffset; final int endOffset; <START> if (index == 0) { <END> copyHeaderBuffer.position(0); startOffset = 4; endOffset = copyHeaderBuffer.getInt(); } else { copyHeaderBuffer.position((index - 1) * Ints.BYTES); startOffset = copyHeaderBuffer.getInt() + 4; endOffset = copyHeaderBuffer.getInt(); } return _get(copyBuffer, startOffset, endOffset); } }; } else { final List<ByteBuffer> copyValueBuffers = Lists.newArrayList( Iterables.transform( valueBuffers, new Function<ByteBuffer, ByteBuffer>() { @Override public ByteBuffer apply(final ByteBuffer buffer) { return buffer.asReadOnlyBuffer(); } } ) ); return new BufferIndexed() { @Override public T get(final int index) { int fileNum = index / numElementsPerValueFile; final ByteBuffer copyBuffer = copyValueBuffers.get(fileNum); if (index < 0) { throw new IAE("Index[%s] < 0", index); } if (index >= size) { throw new IAE(String.format("Index[%s] >= size[%s]", index, size)); } final int startOffset; final int endOffset; if (index % numElementsPerValueFile == 0) { copyHeaderBuffer.position(index * Ints.BYTES); startOffset = 4; endOffset = copyHeaderBuffer.getInt(); } else { copyHeaderBuffer.position((index - 1) * Ints.BYTES); startOffset = copyHeaderBuffer.getInt() + 4; endOffset = copyHeaderBuffer.getInt(); } return _get(copyBuffer, startOffset, endOffset); } }; } }</code><technical_language>This block is identical some block in BufferedIndexed above, consider extracting a method</technical_language>

Target:
public GenericIndexed<T>.BufferIndexed singleThreaded() { if (valueBuffers.size() == 1) { final ByteBuffer copyBuffer = valueBuffers.get(0).asReadOnlyBuffer(); return new BufferIndexed() { @Override public T get(final int index) { checkIndex(index, size); final int startOffset; final int endOffset; if (index == 0) { startOffset = 4; endOffset = headerBuffer.getInt(0); } else { int headerPosition = (index - 1) * Ints.BYTES; startOffset = headerBuffer.getInt(headerPosition) + 4; endOffset = headerBuffer.getInt(headerPosition + 4); } return _get(copyBuffer, startOffset, endOffset); } }; } else { final List<ByteBuffer> copyValueBuffers = new ArrayList<>(); for (ByteBuffer buffer : valueBuffers) { copyValueBuffers.add(buffer.asReadOnlyBuffer()); } return new BufferIndexed() { @Override public T get(final int index) { int fileNum = index >> logBaseTwoOfElementsPerValueFile; final ByteBuffer copyBuffer = copyValueBuffers.get(fileNum); checkIndex(index, size); final int startOffset; final int endOffset; int relativePositionOfIndex = index & ((1 << logBaseTwoOfElementsPerValueFile) - 1); if (relativePositionOfIndex == 0) { int headerPosition = index * Ints.BYTES; startOffset = 4; endOffset = headerBuffer.getInt(headerPosition); } else { int headerPosition = (index - 1) * Ints.BYTES; startOffset = headerBuffer.getInt(headerPosition) + 4; endOffset = headerBuffer.getInt(headerPosition + 4); } return _get(copyBuffer, startOffset, endOffset); } }; } }