void (ActionEvent event) { long moment = System.nanoTime(); Segment segment = null; while (!mySegments.isEmpty()) { segment = mySegments.getFirst(); if (segment.getEnd().getMoment() < moment) { mySegments.removeFirst(); continue; } Integer v = segment.getValueAt(moment); if (v != null && !Objects.equals(v, myInput.get())) { setValue(v); } break; } if (mySegments.isEmpty() && segment != null) { setValue(segment.getEnd().getValue()); } if (moment > myPreviousEventMoment + TIMEOUT) { myTimer.stop(); } }