Create a new Iterable<T> by adding the specified list contents to
the front of an existing Iterable.
@param <T>
@param list
@param rest
@return
169279
static <T> Iterable<T> prepend(Collection<T> coll, Iterable<T> rest) {
        return (coll.size() == 0) ? rest : new CompoundIterable<T>(coll, rest);
    }
831130
public static <T> List<T> createList(final Class<T> type) {
        return new AbstractList<T>() {
            private ExtensionList<T> storage() {
                return Jenkins.getInstance().getExtensionList(type);
            }

            @Override
            public Iterator<T> iterator() {
                return storage().iterator();
            }

            public T get(int index) {
                return storage().get(index);
            }

            public int size() {
                return storage().size();
            }

            @Override
            public boolean add(T t) {
                return storage().add(t);
            }

            @Override
            public void add(int index, T t) {
                // index ignored
                storage().add(t);
            }

            @Override
            public T remove(int index) {
                return storage().remove(index);
            }

            @Override
            public boolean remove(Object o) {
                return storage().remove(o);
            }
        };
    }
691638
public static <T> Iterator<T> reverseIterator(final List<T> list) {
		return new Iterator<T>() {

			private int next = list.size() - 1;

			@Override
			@Pure
			public boolean hasNext() {
				return this.next >= 0;
			}

			@Override
			public T next() {
				final int n = this.next;
				--this.next;
				try {
					return list.get(n);
				} catch (IndexOutOfBoundsException exception) {
					throw new NoSuchElementException();
				}
			}

		};
	}
1138956
public static <T> Collection<T> addAll(Collection<T> collection, Iterable<T> iterable) {
		return addAll(collection, iterable.iterator());
	}
107270
public static <T> List<T> nullToEmpty(final List<T> list) {
        return list == null ? N.<T> emptyList() : list;
    }
391430
public void addAll( List<T> list ) {
		if( list.isEmpty() )
			return;

		Element<T> a = requestNew();
		a.object = list.get(0);

		if( first == null ) {
			first = a;
		} else if( last != null ) {
			last.next = a;
			a.previous = last;
		}

		for (int i = 1; i < list.size(); i++) {
			Element<T> b = requestNew();
			b.object = list.get(i);

			a.next = b;
			b.previous = a;
			a = b;
		}

		last = a;
		size += list.size();
	}
1374466
public static RecurrenceIterator join(RecurrenceIterator first, RecurrenceIterator... rest) {
		List<RecurrenceIterator> all = new ArrayList<RecurrenceIterator>();
		all.add(first);
		all.addAll(Arrays.asList(rest));
		return new CompoundIteratorImpl(all, Collections.<RecurrenceIterator> emptyList());
	}
104066
public static <T> Set<T> toSet(Iterable<T> iterable)
   {
      if (iterable == null)
      {
         return null;
      }
      else if (iterable instanceof Set)
      {
         return (Set<T>) iterable;
      }
      else
      {
         Set<T> list = new LinkedHashSet<>();
         for (T obj : iterable)
         {
            list.add(obj);
         }
         return list;
      }
   }
295339
public static <T> List<T> addAll(List<T> to, List<? extends T> what) {
        List<T> data = safeList(to);
        if (!isEmpty(what)) {
            data.addAll(what);
        }
        return data;
    }
829629
public static <T> C.List<T> toList(Iterable<? extends T> iterable) {
        if (iterable instanceof Collection) {
            return toList((Collection<T>) iterable);
        }
        ListBuilder<T> lb = new ListBuilder<T>(10);
        for (T t : iterable) {
            lb.add(t);
        }
        return lb.toList();
    }
1317948
public static <E> List<E> toList(Iterable<E> iter) {
		return toList(iter.iterator());
	}
654729
public static <T> List<T> iterToList(final Iterable<T> it) {
        if (it instanceof List) {
            return (List<T>) it;
        }
        if (it == null) {
            return null;
        }

        final List<T> ar = new ArrayList<T>();
        for (final T o : it) {
            ar.add(o);
        }

        return ar;
    }
629880
public static <T> List<T> toList(Iterable<T> iter) {
    List<T> buf = new ArrayList<>();
    for (T v : iter) {
      buf.add(v);
    }
    return buf;
  }
431828
@SafeVarargs
    public static <T> Predicate<T> in(@Nonnull T first, @Nonnull T... rest) {
        Collection<T> allowed = ImmutableList.<T>builder()
                .add(first)
                .add(rest)
                .build();

        return Predicates.in(allowed);
    }
245905
protected <T> List<T> toArrayList(List<T> list) {
        if (list == null) {
            return null;
        }
        if (!list.getClass().equals(ArrayList.class)) {
            list = new ArrayList<>(list);
        }
        return list;
    }
597843
public static <T> List<T> synchronizedList(List<T> list) {
		return Collections.synchronizedList(list);
	}
942759
protected Object add(Object list, Collection collection)
    {
        Iterator i=collection.iterator();
        while(i.hasNext())
            list=LazyList.add(list,i.next());
        return list;
    }