1 package com.quantum.util;
3 import java.util.Comparator;
9 public class StringArrayComparator implements Comparator {
11 public int compare(Object arg0, Object arg1) {
12 return compare((String[]) arg0, (String[]) arg1);
15 public int compare(String[] arg0, String[] arg1) {
16 if (arg0 == null && arg1 == null) {
18 } else if (arg0 == null) {
20 } else if (arg1 == null) {
22 } else if (arg0.length != arg1.length) {
23 return arg0.length - arg1.length;
26 for (int i = 0, length = arg0 == null ? 0 : arg0.length;
27 result == 0 && i < length; i++) {
28 result = compare(arg0[i], arg1[i]);
34 private int compare(String arg0, String arg1) {
35 if (arg0 == null && arg1 == null) {
37 } else if (arg0 == null) {
39 } else if (arg1 == null) {
42 return arg0.compareTo(arg1);