
uk.co.probablyfine.matchers.internal.DescriptionUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-8-matchers Show documentation
Show all versions of java-8-matchers Show documentation
Hamcrest matchers for JDK8's Optionals and Streams, and the java.time package
The newest version!
package uk.co.probablyfine.matchers.internal;
import static java.util.Arrays.binarySearch;
public final class DescriptionUtils {
private static final char[] CHARS_FOR_AN = {'A', 'E', 'I', 'O', 'a', 'e', 'i', 'o'};
public static String withPrefixedArticle(String noun) {
return (binarySearch(CHARS_FOR_AN, noun.charAt(0)) < 0 ? "a " : "an ") + noun;
}
private DescriptionUtils() {}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy