int (@NotNull CharSequence text, @NotNull ComparisonPolicy policy) { switch (policy) { case DEFAULT: return Strings.stringHashCode(text); case TRIM_WHITESPACES: int offset1 = trimStart(text, 0, text.length()); int offset2 = trimEnd(text, offset1, text.length()); return Strings.stringHashCode(text, offset1, offset2); case IGNORE_WHITESPACES: return Strings.stringHashCodeIgnoreWhitespaces(text); default: throw new IllegalArgumentException(policy.name()); } }