Why is the debugger showing that it is skipping my loop in this method

	 * Adds an item to the list.  This method assumes that the list is already
	 * sorted in alphabetical order based on the names of the items in the list.
	 * The new item will be inserted into the list in the appropriate place so
	 * that the list will remain alphabetized by names.
	 * In order to accomodate the new item, the internal array must be re-sized 
	 * so that it is one unit larger than it was before the call to this method.
	 * @param itemToAdd refers to a Listable item to be added to this list
	public void add(Listable itemToAdd) {
		Listable[] items2=new Listable[this.items.length+1];
		for(int x=0;x<items.length;x++){                  //this loop and others
		String[] s=new String[items.length];
		for(int x=0;x<items.length;x++){
		String nameitem=itemToAdd.getName();
		boolean go=true;
		int count=0;
		for(int x=0;x<items2.length;x++){
					for(int g=x;g<items2.length;g++){

What is the length of the items array?

Maybe you need to special-case the situation where you are adding the first item to a previously empty list (items.length == 0)?

the constructor starts the size at zero...does that help?? thx so far

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.