Shortcut for as(List.class), with malleable generic type
@see OptionalWeak#as(Class)
338814
public <T> Optional<List<T>> asList() {
        return inner.filter(d -> d.isList()).map(d -> d.asList());
    }
1211194
public <K, V> Map<K, V> asMap(@NonNull Class<?> mapClass, @NonNull Class<K> keyClass, @NonNull Class<V> valueClass) {
      return convert(toConvert, mapClass, keyClass, valueClass);
   }
926547
public <T> T get(Class<T> as) {
    if (content == null) {
      return null;
    }
    if (as == null) {
      throw new IllegalArgumentException("Cannot cast content to null class");
    }
    if (!as.isAssignableFrom(content.getClass())) {
      throw new IllegalArgumentException(
        "Cannot cast "+content.getClass().getName()+" to "+as.getName()
      );
    }
    @SuppressWarnings("unchecked")
    T content = (T) get();
    return content;
  }
1088608
public static <T extends TOP> List<T> asList(Iterable<T> select) {
        return Lists.newLinkedList(select);
    }
1247281
@Override
    public final <TYPE extends Assignable> TYPE as(Class<TYPE> clazz) {
        return this.getArchive().as(clazz);
    }
601603
public <T> List<T> asList() {
		String cacheKey = null;
		
		// is the result of the query cached?
		if (isCacheable() && transaction == null) {
			cacheKey = getCacheKey();
			List<Key> keys = getCacheManager().get(cacheNamespace, cacheKey);
			if (keys != null) {
				if (isKeysOnly()) {
					return (List) keys;
				} else {
					final Map<Key, T> values = entityManager.get(keys);
					return Lists.transform(keys, new Function<Key, T>() {

						@Override
						public T apply(Key key) {
							return values.get(key);
						}
						
					});
				}
			}
		}
		
		// execute the query
		List<T> result = Lists.newArrayList((Iterable<T>) asIterable());
		if (isCacheable()) {
			Collection<Key> keys = isKeysOnly()? result : Collections2.transform(result, new EntityToKeyFunction(classMetadata.getPersistentClass()));
			populateCache(cacheKey, Lists.newArrayList(keys));
		}
		return result;
	}
382961
public static <T extends Comparable<? super T>> T[] asc(final T[] comparableArray) {

        if (comparableArray == null) {
            return null;
        }
        T[] clone = comparableArray.clone();
        ascByReflex(clone);
        return clone;
    }
682146
@SuppressWarnings("unchecked")
    public <U extends BeanPath<? extends T>> U as(Class<U> clazz) {
        try {
            if (!casts.containsKey(clazz)) {
                PathMetadata metadata;
                if (pathMixin.getMetadata().getPathType() != PathType.COLLECTION_ANY) {
                    metadata = PathMetadataFactory.forDelegate(pathMixin);
                } else {
                    metadata = pathMixin.getMetadata();
                }
                U rv;
                // the inits for the subtype will be wider, if it's a variable path
                if (inits != null && pathMixin.getMetadata().getPathType() != PathType.VARIABLE) {
                    rv = clazz.getConstructor(PathMetadata.class, PathInits.class).newInstance(metadata, inits);
                } else {
                    rv = clazz.getConstructor(PathMetadata.class).newInstance(metadata);
                }
                casts.put(clazz, rv);
                return rv;
            } else {
                return (U) casts.get(clazz);
            }

        } catch (InstantiationException e) {
            throw new ExpressionException(e.getMessage(), e);
        } catch (IllegalAccessException e) {
            throw new ExpressionException(e.getMessage(), e);
        } catch (InvocationTargetException e) {
            throw new ExpressionException(e.getMessage(), e);
        } catch (NoSuchMethodException e) {
            throw new ExpressionException(e.getMessage(), e);
        }
    }
81570
private static List<Object> asList(final int n, final Object[] o) {
        return Arrays.asList(o).subList(0, n);
    }
614881
public <T extends Enum<T>> Optional<T> answer(final Class<T> enumClass) {
        return fromNullable(askBuilder.answer(enumClass));
    }
12342
static Collection<AbstractType> asList( Collection<Component> components ) {

		Collection<AbstractType> result = new ArrayList<AbstractType> ();
		result.addAll( components );

		return result;
	}
1311610
public <T> T as(Class<T> type) {
        return type.cast(Proxy.newProxyInstance(type.getClassLoader(), new Class[]{type}, new InvocationHandler() {
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                if (method.getDeclaringClass() == Object.class)
                    return method.invoke(this, args);

                Configuration cn = method.getAnnotation(Configuration.class);

                Class<?> r = method.getReturnType();
                String key = getKey(method,cn);

                String v = source.apply(key);
                if (v==null && cn!=null && !cn.defaultValue().equals(UNSPECIFIED))
                    v = cn.defaultValue();

                if (v==null)    return null;    // TODO: check how the primitive types are handled here

                return ConvertUtils.convert(v,r);
            }

            private String getKey(Method method, Configuration c) {
                if (c!=null && !c.name().equals(UNSPECIFIED))
                    return c.name();        // name override

                String n = method.getName();
                for (String p : GETTER_PREFIX) {
                    if (n.startsWith(p))
                        return Introspector.decapitalize(n.substring(p.length()));
                }
                return n;
            }
        }));
    }
212057
private <T extends ApplicationFeatureViewModel> List<T> asViewModels(final Iterable<ApplicationFeature> features, final Class<T> cls) {
        return Lists.newArrayList(
                Iterables.transform(
                        features,
                        ApplicationFeatureViewModel.Functions.<T>asViewModel(applicationFeatureRepository, container)
                ));
    }
451053
@Override
    public <T> T asFacet(Class<T> facetType)
    {
        if (facetType == SpanProvider.class)
        {
            return facetType.cast(new SpanProviderFacet());
        }

        if (facetType == SeekableReader.class && _scanner.isBufferedInput())
        {
            return facetType.cast(new SeekableReaderFacet());
        }

        return super.asFacet(facetType);
    }
373602
def aslist(obj, sep=None, strip=True):
    
    if isinstance(obj, (basestring)):
        lst = obj.split(sep)
        if strip:
            lst = [v.strip() for v in lst]
        return lst
    elif isinstance(obj, (list, tuple)):
        return obj
    elif obj is None:
        return []
    else:
        return [obj]
289485
public static <T> T as(Object o, @NonNull Class<T> clazz) {
    try {
      return o == null ? null : clazz.cast(o);
    } catch (Exception e) {
      return null;
    }
  }
700172
public Object asObject(@NonNull Class<?> clazz) {
      if (Map.class.isAssignableFrom(clazz)) {
         return asMap(clazz, String.class, String.class);
      } else if (Collection.class.isAssignableFrom(clazz)) {
         return asCollection(clazz, String.class);
      }
      return Object.class.cast(as(clazz));
   }