Хотел решить вот так. Но валидатор ругается на невыполнение условия в случае отсутствия объекта с указанным индексом. public String get(int index) { Node currentElement = first.next; int i = 0; while (i != index) { currentElement = currentElement.next; i++; } return currentElement == null ? null : currentElement.value; } Решил в итоге вот так: public String get(int index) { Node currentElement = first.next; int i = 0; while (i != index) { currentElement = currentElement.next; if (currentElement == null) { return null; } i++; } return currentElement.value; }