Array of object size Grow when Sorting in JAVA
Hi I need to compare objects in a Array [] with Java.
The array contain object named Place. I need the make an ascending sort with the distance (Integer) property of the Place object.

My objet class (Place) implement Comparable interface.

The problem (I think) is with the compareTo function :

    @Override
	public int compareTo(Place place) {  
	      if (this.distance > place.distance)
	         return 1;
	      if (this.distance < place.distance)
	         return -1;
	      else
	         return 0;
	}

Sometimes when I sort the array, the Array size grow. And I can't explain that?

Thanks
Array of object size Grow when Sorting in JAVA
===

Hi I need to compare objects in a Array [] with Java.
The array contain object named Place. I need the make an ascending sort with the distance (Integer) property of the Place object.

My objet class (Place) implement Comparable interface.

The problem (I think) is with the compareTo function :

    @Override
	public int compareTo(Place place) {  
	      if (this.distance > place.distance)
	         return 1;
	      if (this.distance < place.distance)
	         return -1;
	      else
	         return 0;
	}

Sometimes when I sort the array, the Array size grow. And I can't explain that?

Thanks