a-foundation/src/main/java/com/ajjpj/afoundation/collection/immutable/AList.java
public static <T> AList<T> create(Iterable<T> elements) {
        if (elements instanceof AList) {
            return (AList<T>) elements;
        }
        if(elements instanceof List) {
            return create((List<T>) elements);
        }
        AList<T> result = nil();

        for(T el: elements) {
            result = result.cons(el);
        }
        return result.reverse();
    }
public static <T> AList<T> create(Iterable<T> elements) {
        if (elements instanceof AList) {
            return (AList<T>) elements;
        }
        if(elements instanceof List) {
            return create((List<T>) elements);
        }
        AList<T> result = nil();

        for(T el: elements) {
            result = result.cons(el);
        }
        return result.reverse();
    }
public static < T > AList < T > create ( Iterable < T > elements ) { if ( elements instanceof AList ) { return ( AList < T > ) elements ; } if ( elements instanceof List ) { return create ( ( List < T > ) elements ) ; } AList < T > result = nil ( ) ; for ( T el : elements ) { result = result . cons ( el ) ; } return result . reverse ( ) ; }
Creates an AList based on the contents of an existing <code>java.util.Iterable</code>, copying its contents.
Creates an AList based on the contents of an existing <code > java . util . Iterable< / code > copying its contents .