void (Predicate<Character> condition, Consumer<Character> action) { int currentIndex = 0; while (currentIndex < sequence.length() && condition.test(sequence.charAt(currentIndex))) { action.accept(sequence.charAt(currentIndex)); currentIndex++; } }