@Test public void aLanguageWithPrimaryTagAndSubtagIncludesItself() throws Exception { assertThat(Languages.includes(US_ENGLISH, US_ENGLISH),equalTo(true)); }
public static boolean includes(final Language language1, final Language language2) { if(language1==null || language2==null) { return false; } if(language1.isWildcard()) { return true; } if(language2.isWildcard()) { return false; } return language1.primaryTag().equals(language2.primaryTag()) && (language1.subTag().isEmpty() || language1.subTag().equals(language2.subTag())); }
Languages { public static boolean includes(final Language language1, final Language language2) { if(language1==null || language2==null) { return false; } if(language1.isWildcard()) { return true; } if(language2.isWildcard()) { return false; } return language1.primaryTag().equals(language2.primaryTag()) && (language1.subTag().isEmpty() || language1.subTag().equals(language2.subTag())); } }
Languages { public static boolean includes(final Language language1, final Language language2) { if(language1==null || language2==null) { return false; } if(language1.isWildcard()) { return true; } if(language2.isWildcard()) { return false; } return language1.primaryTag().equals(language2.primaryTag()) && (language1.subTag().isEmpty() || language1.subTag().equals(language2.subTag())); } private  Languages(); }
Languages { public static boolean includes(final Language language1, final Language language2) { if(language1==null || language2==null) { return false; } if(language1.isWildcard()) { return true; } if(language2.isWildcard()) { return false; } return language1.primaryTag().equals(language2.primaryTag()) && (language1.subTag().isEmpty() || language1.subTag().equals(language2.subTag())); } private  Languages(); static Language wildcard(); static Language of(final Locale locale); static Language fromString(final String language); static boolean includes(final Language language1, final Language language2); }
Languages { public static boolean includes(final Language language1, final Language language2) { if(language1==null || language2==null) { return false; } if(language1.isWildcard()) { return true; } if(language2.isWildcard()) { return false; } return language1.primaryTag().equals(language2.primaryTag()) && (language1.subTag().isEmpty() || language1.subTag().equals(language2.subTag())); } private  Languages(); static Language wildcard(); static Language of(final Locale locale); static Language fromString(final String language); static boolean includes(final Language language1, final Language language2);  }