I can't get past the last condition
package com.codegym.task.task17.task1703;
import java.util.ArrayList;
import java.util.List;
/*
Synchronized notes
*/
public class Solution {
public static void main(String[] args) {
}
public static class Note {
public final List<String> notes = new ArrayList<>();
public void addNote(int index, String note) {
synchronized(notes){
System.out.println("A note [" + note + "] will now be added at position " + index);
notes.add(index, note);
System.out.println("The note [" + note + "] has already been added");
}
}
public void removeNote(int index) {
synchronized(notes){
String note = notes.remove(index);
}
System.out.println("A note will now be deleted from position " + index);
String note = notes.remove(index);
System.out.println("The note [" + note + "] has already been deleted from position " + index);
}
} // synchronized (notes){ // notes.remove(index); } System.out.println("A note will now be deleted from position " + index); String note = notes.remove(index) ; System.out.println("The note [" + note + "] has already been deleted from position " + index); }
}