LinkedList index access quadratic

Code reviewHard20 min

Your task

Review this Java method that pairs up adjacent samples from a buffer. The buffer is a LinkedList and the method is slow on large inputs.