1 11 package org.eclipse.ui.externaltools.internal.launchConfigurations; 12 13 import java.util.Comparator ; 14 15 public class IgnoreWhiteSpaceComparator implements Comparator { 16 17 20 public int compare(Object o1, Object o2) { 21 String one= (String )o1; 22 String two= (String )o2; 23 int i1 = 0; 24 int i2 = 0; 25 int l1 = one.length(); 26 int l2 = two.length(); 27 char ch1 = ' '; 28 char ch2 = ' '; 29 while (i1 < l1 && i2 < l2) { 30 while (i1 < l1 && Character.isWhitespace(ch1 = one.charAt(i1))) { 31 i1++; 32 } 33 while (i2 < l2 && Character.isWhitespace(ch2 = two.charAt(i2))) { 34 i2++; 35 } 36 if (i1 == l1 && i2 == l2) { 37 return 0; 38 } 39 if (ch1 != ch2) { 40 return -1; 41 } 42 i1++; 43 i2++; 44 } 45 return 0; 46 } 47 } 48 | Popular Tags |