Class VarListBuilderWithSortAndApply<T,​U>


  • public class VarListBuilderWithSortAndApply<T,​U>
    extends java.lang.Object
    VarListBuilderWithSortAndApply<T, U> - Documentation.

    This class will build an suite of implementations of the VarList interface. This version provides the ability to sort and then transform the input list-class.



    • Field Detail

      • VECTOR

        public final VarList<java.util.Vector<U>,​T> VECTOR
        This VarList instance has a 'retrieve()' method that will return a Vector whose Vector-contents are of parametrized-type 'U'. The Vector returned will have already been sorted upon return.
        Code:
        Exact Field Declaration Expression:
        1
        public final VarList<Vector<U>, T>          VECTOR;
        
      • ARRAYLIST

        public final VarList<java.util.ArrayList<U>,​T> ARRAYLIST
        This VarList instance has a 'retrieve()' method that will return an ArrayList whose ArrayList-contents are of parametrized-type 'U'. The ArrayList returned will have already been sorted upon return.
        Code:
        Exact Field Declaration Expression:
        1
        public final VarList<ArrayList<U>, T>       ARRAYLIST;
        
      • ITERATOR

        public final VarList<java.util.Iterator<U>,​T> ITERATOR
        This VarList instance has a 'retrieve()' method that will return an Iterator whose Iterator-contents are of parametrized-type 'U'. The Iterator returned will have already been sorted upon return.
        Code:
        Exact Field Declaration Expression:
        1
        public final VarList<Iterator<U>, T>        ITERATOR;
        
      • ARRAY

        public final VarList<U[],​T> ARRAY
        This VarList instance has a 'retrieve()' method that will return an array whose array-contents are of parametrized-type 'U'. The array returned will have already been sorted upon return.
        Code:
        Exact Field Declaration Expression:
        1
        public final VarList<U[], T>                ARRAY;
        
      • STREAM

        public final VarList<java.util.stream.Stream<U>,​T> STREAM
        This VarList instance has a 'retrieve()' method that will return a Stream whose Stream-contents are of parametrized-type 'U'. The Stream returned will have already been sorted upon return.
        Code:
        Exact Field Declaration Expression:
        1
        public final VarList<Stream<U>, T>          STREAM;
        
      • STREAM_BUILDER

        public final VarList<java.util.stream.Stream.Builder<U>,​T> STREAM_BUILDER
        Instances of Stream.Builder cannot be sorted. Only a built Stream may be sorted. Therefore this parameter shall always be null.
        Code:
        Exact Field Declaration Expression:
        1
        public final VarList<Stream.Builder<U>, T>  STREAM_BUILDER = null;
        
      • LINKEDLIST

        public final VarList<java.util.LinkedList<U>,​T> LINKEDLIST
        This VarList instance has a 'retrieve()' method that will return a LinkedList whose LinkedList-contents are of parametrized-type 'U'. The LinkedList returned will have already been sorted upon return.
        Code:
        Exact Field Declaration Expression:
        1
        public final VarList<LinkedList<U>, T>      LINKEDLIST;
        
      • STACK

        public final VarList<java.util.Stack<U>,​T> STACK
        This VarList instance has a 'retrieve()' method that will return a Stack whose Stack-contents are of parametrized-type 'U'. The Stack returned will have already been sorted upon return.
        Code:
        Exact Field Declaration Expression:
        1
        public final VarList<Stack<U>, T>           STACK;
        
    • Constructor Detail

      • VarListBuilderWithSortAndApply

        public VarListBuilderWithSortAndApply​
                    (java.util.Comparator<T> comparator,
                     java.util.function.Function<T,​U> transformer,
                     java.lang.Class<U> outputClass)
        
        Builds all 8 of the VarList's provided by this builder class.
        Parameters:
        comparator - This is used to sort the returned list.

        NOTICE: The 'comparator' is of parametrized-type 'T'. This is because the sort shall occur BEFORE the transform.
        transformer - This transform is used to convert the contents of the returned list-type. As noticed by its type, 'Function<T, U>', the final type of the returned VarList will of type 'U', although while building this 'VarList', the elements that shall be inserted will be of type 'T'.

        It is the job of the transformer parameter to convert the elements from type 'T' to type 'U'
        outputClass - The final list that is built will be of type class U. Because java generics use "Type Erasure," this class must be obtained here. It is used for array generation or array-construction.