@Test
 public void detectIndexWithSmallList() {
   ArrayList<Integer> list = new ArrayList<Integer>(Interval.toReverseList(1, 5));
   Assert.assertEquals(4, Iterate.detectIndexWith(list, Predicates2.equal(), 1));
   Assert.assertEquals(0, Iterate.detectIndexWith(list, Predicates2.equal(), 5));
   Assert.assertEquals(-1, Iterate.detectIndexWith(list, Predicates2.equal(), 10));
 }
 @Test
 public void detectIndexOver100() {
   ArrayList<Integer> list = new ArrayList<Integer>(Interval.toReverseList(1, 101));
   Assert.assertEquals(100, ArrayListIterate.detectIndex(list, Predicates.equal(1)));
   Assert.assertEquals(0, Iterate.detectIndex(list, Predicates.equal(101)));
   Assert.assertEquals(-1, Iterate.detectIndex(list, Predicates.equal(200)));
 }
 @Test
 public void groupByWithOptimisedList() {
   ArrayList<Integer> list = new ArrayList<Integer>(Interval.toReverseList(1, 105));
   MutableMultimap<String, Integer> target = new FastListMultimap<String, Integer>();
   MutableMultimap<String, Integer> result =
       ArrayListIterate.groupBy(list, Functions.getToString(), target);
   Assert.assertEquals(result.get("105"), FastList.newListWith(105));
 }
  @Test
  public void flattenWithOptimisedArrays() {
    ArrayList<Integer> list = new ArrayList<Integer>(Interval.toReverseList(1, 105));

    ArrayList<Integer> result =
        ArrayListIterate.flatCollect(
            list, new CollectionWrappingFunction<Integer>(), new ArrayList<Integer>());
    Assert.assertEquals(105, result.get(0).intValue());
  }
 @Test
 public void groupByEachWithOptimisedList() {
   ArrayList<Integer> list = new ArrayList<Integer>(Interval.toReverseList(1, 105));
   Function<Integer, Iterable<String>> function =
       new Function<Integer, Iterable<String>>() {
         public Iterable<String> valueOf(Integer object) {
           return FastList.newListWith(object.toString(), object.toString() + '*');
         }
       };
   MutableMultimap<String, Integer> target = new FastListMultimap<String, Integer>();
   MutableMultimap<String, Integer> result = ArrayListIterate.groupByEach(list, function, target);
   Assert.assertEquals(result.get("105"), FastList.newListWith(105));
   Assert.assertEquals(result.get("105*"), FastList.newListWith(105));
 }
 private ArrayList<Integer> getOver100IntegerList() {
   return new ArrayList<Integer>(Interval.toReverseList(1, 105));
 }