Пример #1
0
 public <V> MutableList<V> collect(BooleanToObjectFunction<? extends V> function) {
   FastList<V> target = FastList.newList(this.size);
   for (int i = 0; i < this.size; i++) {
     target.add(function.valueOf(this.items.get(i)));
   }
   return target;
 }
 public <V> MutableSet<V> collect(BooleanToObjectFunction<? extends V> function) {
   UnifiedSet<V> target = UnifiedSet.newSet(this.size());
   switch (this.state) {
     case 0:
       return target;
     case 1:
       return target.with(function.valueOf(false));
     case 2:
       return target.with(function.valueOf(true));
     case 3:
       target.add(function.valueOf(false));
       target.add(function.valueOf(true));
       return target;
     default:
       throw new AssertionError("Invalid state");
   }
 }
Пример #3
0
 public <V> MutableList<V> collect(BooleanToObjectFunction<? extends V> function) {
   MutableList<V> results = FastList.newList(BooleanArrayList.this.size);
   BooleanIterator iterator = this.booleanIterator();
   while (iterator.hasNext()) {
     results.add(function.valueOf(iterator.next()));
   }
   return results;
 }