@Test
 public void attributeBetweenInclusive() {
   Predicate<Pair<Integer, ?>> predicate =
       Predicates.attributeBetweenInclusive(Functions.firstOfPair(), 9, 11);
   assertAccepts(predicate, Tuples.twin(9, 0), Tuples.twin(10, 0), Tuples.twin(11, 0));
   assertRejects(predicate, Tuples.twin(8, 0), Tuples.twin(12, 0));
 }
 @Test
 public void forEachInBoth() {
   MutableList<Pair<String, String>> list = MultiReaderFastList.newList();
   MutableList<String> list1 = MultiReaderFastList.newListWith("1", "2");
   MutableList<String> list2 = MultiReaderFastList.newListWith("a", "b");
   ListIterate.forEachInBoth(
       list1, list2, (argument1, argument2) -> list.add(Tuples.pair(argument1, argument2)));
   Assert.assertEquals(FastList.newListWith(Tuples.pair("1", "a"), Tuples.pair("2", "b")), list);
 }
 @Test
 public void attributeNotNull() {
   Twin<String> testCandidate = Tuples.twin("Hello", null);
   assertAccepts(Predicates.attributeNotNull(Functions.firstOfPair()), testCandidate);
   assertRejects(Predicates.attributeNotNull(Functions.secondOfPair()), testCandidate);
   assertToString(Predicates.attributeNotNull(Functions.<String>firstOfPair()));
 }
  private void checkMutability(MutableSortedMap<Integer, String> map) {
    Verify.assertThrows(UnsupportedOperationException.class, () -> map.put(3, "3"));

    Verify.assertThrows(
        UnsupportedOperationException.class,
        () -> map.putAll(TreeSortedMap.newMapWith(1, "1", 2, "2")));

    Verify.assertThrows(UnsupportedOperationException.class, () -> map.remove(2));

    Verify.assertThrows(UnsupportedOperationException.class, map::clear);

    Verify.assertThrows(UnsupportedOperationException.class, () -> map.with(Tuples.pair(1, "1")));
  }
 @Benchmark
 public void parallel_lazy_ec() {
   UnsortedSetMultimap<Alphagram, String> multimap =
       this.ecWords.asParallel(this.executorService, BATCH_SIZE).groupBy(Alphagram::new);
   FastList<Pair<Integer, String>> pairs =
       (FastList<Pair<Integer, String>>)
           FastList.newList(multimap.multiValuesView())
               .asParallel(this.executorService, BATCH_SIZE)
               .select(iterable -> iterable.size() >= SIZE_THRESHOLD)
               .collect(
                   iterable -> Tuples.pair(iterable.size(), iterable.size() + ": " + iterable))
               .toSortedList((pair1, pair2) -> Integer.compare(pair2.getOne(), pair1.getOne()));
   pairs
       .asParallel(this.executorService, BATCH_SIZE)
       .collect(Pair::getTwo)
       .forEach(Procedures.cast(e -> Assert.assertFalse(e.isEmpty())));
 }
 @Test
 public void cartesianProduct() {
   MutableSet<Integer> set1 = UnifiedSet.newSetWith(1, 2);
   MutableSet<Integer> set2 = UnifiedSet.newSetWith(2, 3, 4);
   MutableBag<Pair<Integer, Integer>> expectedCartesianProduct =
       Bags.mutable.of(
           Tuples.pair(1, 2),
           Tuples.pair(2, 2),
           Tuples.pair(1, 3),
           Tuples.pair(2, 3),
           Tuples.pair(1, 4),
           Tuples.pair(2, 4));
   Assert.assertEquals(expectedCartesianProduct, Sets.cartesianProduct(set1, set2).toBag());
 }
 @Test
 public void mutableSet() {
   MutableSetMultimap<Integer, Integer> empty = Multimaps.mutable.set.of();
   MutableSetMultimap<Integer, Integer> emptyWith = Multimaps.mutable.set.with();
   Verify.assertEmpty(empty);
   Verify.assertEmpty(emptyWith);
   MutableSetMultimap<Integer, Integer> one = Multimaps.mutable.set.of(1, 1);
   Assert.assertEquals(UnifiedSetMultimap.newMultimap(Tuples.pair(1, 1)), one);
   MutableSetMultimap<Integer, Integer> two = Multimaps.mutable.set.of(1, 1, 2, 2);
   Assert.assertEquals(UnifiedSetMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2)), two);
   MutableSetMultimap<Integer, Integer> three = Multimaps.mutable.set.of(1, 1, 2, 2, 3, 3);
   Assert.assertEquals(
       UnifiedSetMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2), Tuples.pair(3, 3)),
       three);
 }
 @Test
 public void immutableBag() {
   ImmutableBagMultimap<Integer, Integer> empty = Multimaps.immutable.bag.of();
   ImmutableBagMultimap<Integer, Integer> emptyWith = Multimaps.immutable.bag.with();
   Verify.assertEmpty(empty);
   Verify.assertEmpty(emptyWith);
   ImmutableBagMultimap<Integer, Integer> one = Multimaps.immutable.bag.of(1, 1);
   Assert.assertEquals(HashBagMultimap.newMultimap(Tuples.pair(1, 1)), one);
   ImmutableBagMultimap<Integer, Integer> two = Multimaps.immutable.bag.of(1, 1, 2, 2);
   Assert.assertEquals(HashBagMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2)), two);
   ImmutableBagMultimap<Integer, Integer> three = Multimaps.immutable.bag.of(1, 1, 2, 2, 3, 3);
   Assert.assertEquals(
       HashBagMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2), Tuples.pair(3, 3)),
       three);
 }
 @Test
 public void immutableSortedSet() {
   ImmutableSortedSetMultimap<Integer, Integer> empty =
       Multimaps.immutable.sortedSet.of(Integer::compareTo);
   ImmutableSortedSetMultimap<Integer, Integer> emptyWith =
       Multimaps.immutable.sortedSet.with(Integer::compareTo);
   Verify.assertEmpty(empty);
   Verify.assertEmpty(emptyWith);
   ImmutableSortedSetMultimap<Integer, Integer> one =
       Multimaps.immutable.sortedSet.of(Integer::compareTo, 1, 1);
   Assert.assertEquals(TreeSortedSetMultimap.newMultimap(Tuples.pair(1, 1)), one);
   ImmutableSortedSetMultimap<Integer, Integer> two =
       Multimaps.immutable.sortedSet.of(Integer::compareTo, 1, 1, 2, 2);
   Assert.assertEquals(
       TreeSortedSetMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2)), two);
   ImmutableSortedSetMultimap<Integer, Integer> three =
       Multimaps.immutable.sortedSet.of(Integer::compareTo, 1, 1, 2, 2, 3, 3);
   Assert.assertEquals(
       TreeSortedSetMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2), Tuples.pair(3, 3)),
       three);
 }
 public static <T, V1, V2> Function<T, Pair<V1, V2>> pair(
     Function<? super T, V1> function1, Function<? super T, V2> function2) {
   return t -> Tuples.pair(function1.valueOf(t), function2.valueOf(t));
 }
 @Override
 @Test(expected = UnsupportedOperationException.class)
 public void withAllKeyValueArguments() {
   this.newMapWithKeysValues("A", 1, "B", 2)
       .withAllKeyValueArguments(Tuples.pair("B", 22), Tuples.pair("C", 3));
 }
 @Override
 @Test(expected = UnsupportedOperationException.class)
 public void with() {
   this.newMapWithKeysValues(1, "1", 2, "2").with(Tuples.pair(3, "3"));
 }
 @Test
 public void attributeIsNullWithFunctionName() {
   Twin<Integer> target = Tuples.twin(null, 1);
   assertAccepts(Predicates.attributeIsNull(Functions.firstOfPair()), target);
   assertRejects(Predicates.attributeIsNull(Functions.secondOfPair()), target);
 }
 @Test
 public void ifFalseWithClassAndFunctionName() {
   Twin<Boolean> target = Tuples.twin(true, false);
   assertRejects(Predicates.ifFalse(Functions.firstOfPair()), target);
   assertAccepts(Predicates.ifFalse(Functions.secondOfPair()), target);
 }
 public void value(T each) {
   this.target.add(Tuples.pair(each, Integer.valueOf(this.index)));
   this.index += 1;
 }
 @Override
 public void add() {
   Verify.assertThrows(
       UnsupportedOperationException.class,
       () -> this.newMapWithKeyValue("A", 1).add(Tuples.pair("A", 3)));
 }
 @Override
 protected ImmutableMap<Integer, String> classUnderTest() {
   return new ImmutableUnifiedMap<>(
       Tuples.pair(1, "1"), Tuples.pair(2, "2"), Tuples.pair(3, "3"), Tuples.pair(4, "4"));
 }