List<String> (int size) { if(size < 0) { // throwing is not a contract violation throw new IllegalArgumentException(); } ArrayList<String> list = new ArrayList<>(); for(int i=0; i<size; i++) list.add(""); return list; }