src/main/java/com/zandero/utils/StringUtils.java
public static String sanitizeWhitespace(String input) {

		Assert.notNull(input, "Missing input!");
		input = input.replaceAll("\\s+", " ");
		return input.trim();
	}
public static String sanitizeWhitespace(String input) {

		Assert.notNull(input, "Missing input!");
		input = input.replaceAll("\\s+", " ");
		return input.trim();
	}
public static String sanitizeWhitespace ( String input ) { Assert . notNull ( input , "Missing input!" ) ; input = input . replaceAll ( "\\s+" , " " ) ; return input . trim ( ) ; }
Removes all multiple-consecutive whitespace characters (space, tab, newline) and replaces them with single space.
Also removes leading and trailing spaces.

@param input to be sanitized
@return sanitized output

@throws IllegalArgumentException in case input is null or empty
Removes all multiple - consecutive whitespace characters ( space tab newline ) and replaces them with single space . Also removes leading and trailing spaces .