public static <E>List<E> asList(Iterable<E> iterable){
  if (iterable instanceof List) {
    return (List<E>)iterable;
  }
  List<E> result=new ArrayList<E>();
  for (  E e : iterable) {
    result.add(e);
  }
  return result;
}

public static < E > List < E > asList ( Iterable < E > iterable ) { if ( iterable instanceof List ) { return ( List < E > ) iterable ; } List < E > result = new ArrayList < E > ( ) ; for ( E e : iterable ) { result . add ( e ) ; } return result ; }
returns the given iterable as a list . if the current iterable is already a list , then the iterable is returned directly . otherwise a new list is created with the same elements as the given iterable .
