/** * Initializes the GeometryList to use the given {@link GeometryComparator} * to use for comparing geometries. * * @param comparator The comparator to use. */ public GeometryList(GeometryComparator comparator) { size = 0; geometries = new Geometry[DEFAULT_SIZE]; this.comparator = comparator; listSort = new ListSort<Geometry>(); }
public static void main(String[] argv) { Integer[] arr = new Integer[]{5, 6, 2, 9, 10, 11, 12, 8, 3, 12, 3, 7, 12, 32, 458, 12, 5, 3, 78, 45, 12, 32, 58, 45, 65, 45, 98, 45, 65, 2, 3, 47, 21, 35}; ListSort ls = new ListSort(); ls.allocateStack(34); ls.sort(arr, new Comparator<Integer>() { public int compare(Integer o1, Integer o2) { int x = o1 - o2; return (x == 0) ? 0 : (x > 0) ? 1 : -1; } }); for (Integer integer : arr) { System.err.print(integer + ","); } System.err.println(); }
/** * Initializes the GeometryList to use the given {@link GeometryComparator} * to use for comparing geometries. * * @param comparator The comparator to use. */ public GeometryList(GeometryComparator comparator) { size = 0; geometries = new Geometry[DEFAULT_SIZE]; this.comparator = comparator; listSort = new ListSort<Geometry>(); }
public static void main(String[] argv) { Integer[] arr = new Integer[]{5, 6, 2, 9, 10, 11, 12, 8, 3, 12, 3, 7, 12, 32, 458, 12, 5, 3, 78, 45, 12, 32, 58, 45, 65, 45, 98, 45, 65, 2, 3, 47, 21, 35}; ListSort ls = new ListSort(); ls.allocateStack(34); ls.sort(arr, new Comparator<Integer>() { public int compare(Integer o1, Integer o2) { int x = o1 - o2; return (x == 0) ? 0 : (x > 0) ? 1 : -1; } }); for (Integer integer : arr) { System.err.print(integer + ","); } System.err.println(); }