Class VarListBuilderWithApplyAndSort<ORIGINAL,​TRANSFORMED>

  • Type Parameters:
    ORIGINAL - This is the original 'type' of the container's contents, before those contents are transformed. In the case of FileNode and FileNode.RetTypeChoice, this shall always be type FileNode.

    IMPORTANT: The Sort is performed after the Apply transformation.
    TRANSFORMED - This is the 'type' of the contents of the container that is ultimately returned to the user by this 'VarList' selection-choice. Note that the salient point is the original container's content's type is transformed, and that the returned container's content's type will not be the same as the input-type, after the transformation

    In the case of FileNode and FileNode.RetTypeChoice, the usage of this builder class is (sort-of) "a cute way of saying" FileNode.toString() and / or FileNode.getFullPathName() - depending upon whether the user is requesting one of the 'FILENAME' variants, or one of the 'FULLPATH' variants

    NOTE:In the above two mentioned cases, type <TRANSFORMED> type will be java.lang.String. (While the <ORIGINAL> type is 'FileNode').

    public class VarListBuilderWithApplyAndSort<ORIGINAL,​TRANSFORMED>
    extends java.lang.Object
    Implementation of the FileNode class 'RetTypeChoice'.

    Java HTML Library Helper for Torello.Java.FileNode

    Currently, the only application for the VarList User-Specified Variable Return Type Interface is for the FileNode helper-class 'RetTypeChoice'.

    This class could theoretically be used wherever there are many container-variants for the same set of identical-data being returned to a user.

    This class will build an suite of implementations of the VarList interface. This version provides the ability to transform and also sort the list-contents class / type.


    • Field Detail

      • VECTOR

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

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

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

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

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

        🡅  🡇    
        public final VarList<java.util.stream.Stream.Builder<TRANSFORMED>,​ORIGINAL> 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:
         public final VarList<Stream.Builder<TRANSFORMED>, ORIGINAL> STREAM_BUILDER = null;
        
      • LINKEDLIST

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

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

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

      • VarListBuilderWithApplyAndSort

        🡅    
        public VarListBuilderWithApplyAndSort​
                    (java.util.function.Function<ORIGINAL,​TRANSFORMED> transformer,
                     java.util.Comparator<TRANSFORMED> comparator,
                     java.lang.Class<TRANSFORMED> outputClass)
        
        Builds all 8 of the VarList's provided by this builder class.
        Parameters:
        transformer - This transform is used to convert the contents of the returned list-type. As noticed by its type, 'Function<ORIGINAL, TRANSFORMED>', the final type of the returned VarList will of type 'TRANSFORMED', although while building this 'VarList', the elements that shall be inserted will be of type 'ORIGINAL'.

        It is the job of the transformer parameter to convert the elements from type 'ORIGINAL' to type 'TRANSFORMED'
        comparator - This is used to sort the returned list. Notice that this 'comparator' shall sort list-elements of type 'TRANSFORMED'. The list that is ultimately returned by these VarList's will be of type 'TRANSFORMED'.

        NOTICE The 'comparator' is of parametrized-type 'TRANSFORMED'. This is because the sort shall occur AFTER the transform.
        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.