Util { public static boolean contains( String[] a, int length, String s) { for (int i = 0; i < length; i++) { if (a[i].equals(s)) { return true; } } return false; } private  Util(); static void discard(Object o); static void discard(int i); static boolean discard(boolean b); static void discard(double d); static void swallow(
      Throwable e,
      Logger logger); static boolean equal(
      Object s0,
      Object s1); static boolean equalShallow(
      List<? extends T> list0, List<? extends T> list1); static int hash(
      int i,
      int j); static int hash(
      int h,
      Object o); static int hashArray(
      int h,
      Object[] a); static int hashV(Object... a); static int hashCode(double v); static Set<T> minus(Set<T> set1, Set<T> set2); static double nLogN(double d); static void print(
      PrintWriter pw,
      Object o); static void print(
      PrintWriter pw,
      Object o,
      int indent); static void printJavaString(
      PrintWriter pw,
      String s,
      boolean nullMeansNull); static void println(
      PrintWriter pw,
      Object o); static String toScientificNotation(BigDecimal bd); static String replace(
      String s,
      String find,
      String replace); static URL toURL(File file); static String getFileTimestamp(); static String stripDoubleQuotes(String value); static String toJavaId(
      String s,
      int ordinal); static String toLinux(String s); static List<T> toList(Iterator<T> iter); static boolean isNullOrEmpty(String s); static String commaList(List<T> list); static String sepList(List<T> list, String sep); static Charset getDefaultCharset(); static Error newInternal(); static Error newInternal(String s); static Error newInternal(Throwable e); static Error newInternal(Throwable e, String s); static String getMessages(Throwable t); static String getStackTrace(Throwable t); static void pre(boolean b, String description); static void post(boolean b, String description); static void permAssert(boolean b, String description); static RuntimeException needToImplement(Object o); static T deprecated(T argument, boolean fail); static void loadLibrary(String libName); static boolean contains(
      String[] a,
      int length,
      String s); static String readAllAsString(Reader reader); static void squelchJar(JarFile jar); static void squelchStream(InputStream stream); static void squelchStream(OutputStream stream); static void squelchReader(Reader reader); static void squelchWriter(Writer writer); static void squelchStmt(Statement stmt); static void squelchConnection(Connection connection); static String rtrim(String s); static String rpad(String s, int len); static String toString(
      Iterable<T> iterable, String start, String sep, String end); static String toPosix(TimeZone tz, boolean verbose); static Locale parseLocale(String localeString); static int runApplication(
      String[] cmdarray,
      Logger logger,
      Reader appInput,
      Writer appOutput); static ProcessBuilder newAppProcess(String[] cmdarray); static int runAppProcess(
      ProcessBuilder pb,
      Logger logger,
      Reader appInput,
      Writer appOutput); static List<E> cast(List<? super E> list, Class<E> clazz); static Iterator<E> cast(
      final Iterator<?> iter,
      final Class<E> clazz); static Iterable<E> cast(
      final Iterable<? super E> iterable,
      final Class<E> clazz); static Iterable<E> filter(
      final Iterable<? extends Object> iterable,
      final Class<E> includeFilter); static Collection<E> filter(
      final Collection<?> collection,
      final Class<E> includeFilter); static List<E> filter(
      final List<?> list,
      final Class<E> includeFilter); static Map<String, String> toMap(
      final Properties properties); static Map<K, V> mapOf(K key, V value, Object... keyValues); static Error unexpected(E value); static Map<String, T> enumConstants(
      Class<T> clazz); @SuppressWarnings({"unchecked" }) static synchronized T enumVal(
      Class<T> clazz,
      String name); static List<E> quotientList(
      final List<E> list, final int n, final int k); static T first(T t0, T t1); static Iterable<T> orEmpty(Iterable<T> t0); static E last(List<E> list); static List<E> skipLast(List<E> list); static List<E> skipLast(List<E> list, int n); static List<E> last(List<E> list, int n); static List<E> skip(List<E> list); static List<E> skip(List<E> list, int fromIndex); static List<Integer> range(final int start, final int end); static String toCamelCase(String name); static String camelToUpper(String name); static boolean isDistinct(List<E> list); static int firstDuplicate(List<E> list); static int match2(List<String> strings, String name,
      boolean caseSensitive1); static boolean match(boolean caseSensitive, String name1,
      String name0); static boolean startsWith(List<E> list0, List<E> list1); static final String AWT_WORKAROUND_PROPERTY; static final String LINE_SEPARATOR; static final String FILE_SEPARATOR; static final String FILE_TIMESTAMP_FORMAT; }
@Test public void testContains() { assertTrue(BitSets.contains(BitSets.range(0, 5), BitSets.range(2, 4))); assertTrue(BitSets.contains(BitSets.range(0, 5), BitSets.of(4))); assertFalse(BitSets.contains(BitSets.range(0, 5), BitSets.of(14))); assertFalse(BitSets.contains(BitSets.range(20, 25), BitSets.of(14))); final BitSet empty = BitSets.of(); assertTrue(BitSets.contains(BitSets.range(20, 25), empty)); assertTrue(BitSets.contains(empty, empty)); assertTrue(BitSets.contains(BitSets.of(1, 4, 7), BitSets.of(1, 4, 7))); }
@Test public void testCompositeMap() { String[] beatles = {"john", "paul", "george", "ringo"}; Map<String, Integer> beatleMap = new LinkedHashMap<String, Integer>(); for (String beatle : beatles) { beatleMap.put(beatle, beatle.length()); } CompositeMap<String, Integer> map = CompositeMap.of(beatleMap); checkCompositeMap(beatles, map); map = CompositeMap.of( beatleMap, Collections.<String, Integer>emptyMap()); checkCompositeMap(beatles, map); map = CompositeMap.of( Collections.<String, Integer>emptyMap(), beatleMap); checkCompositeMap(beatles, map); map = CompositeMap.of(beatleMap, beatleMap); checkCompositeMap(beatles, map); final Map<String, Integer> founderMap = new LinkedHashMap<String, Integer>(); founderMap.put("ben", 1706); founderMap.put("george", 1732); founderMap.put("thomas", 1743); map = CompositeMap.of(beatleMap, founderMap); assertThat(map.isEmpty(), equalTo(false)); assertThat(map.size(), equalTo(6)); assertThat(map.keySet().size(), equalTo(6)); assertThat(map.entrySet().size(), equalTo(6)); assertThat(map.values().size(), equalTo(6)); assertThat(map.containsKey("john"), equalTo(true)); assertThat(map.containsKey("george"), equalTo(true)); assertThat(map.containsKey("ben"), equalTo(true)); assertThat(map.containsKey("andrew"), equalTo(false)); assertThat(map.get("ben"), equalTo(1706)); assertThat(map.get("george"), equalTo(6)); assertThat(map.values().contains(1743), equalTo(true)); assertThat(map.values().contains(1732), equalTo(false)); assertThat(map.values().contains(1999), equalTo(false)); }