Here you can find the source of areEqual(String seq1, String seq2)
public static boolean areEqual(String seq1, String seq2)
//package com.java2s; //License from project: Open Source License public class Main { public static boolean areEqual(String seq1, String seq2) { return trim(seq1).equals(trim(seq2)); }/*from w w w .j a v a 2 s . co m*/ public static String trim(String toTrim) { if (toTrim.length() == 0) return toTrim; StringBuilder result = new StringBuilder(); int length = toTrim.length(); boolean space = false; for (int i = 0; i < length; i++) { char current = toTrim.charAt(i); if (Character.isWhitespace(current)) { space = result.length() > 0; continue; } if (Character.isJavaIdentifierPart(current)) if (space && Character.isJavaIdentifierPart(result.charAt(result.length() - 1))) result.append(' '); result.append(current); space = false; } return result.toString(); } }