Interface VarList<A,​B>


  • public interface VarList<A,​B>
    VarList<A, B> - Documentation

    Allows returns of different variations of lists from a single method.



    • Method Detail

      • create

        VarList<A,​Bcreate()
        This returns a 'new' instance of 'this' VarList interface.
        Returns:
        An instance of the invoking VarList<A, B>. It is expected any internal information, such as transforms or sorts be preserved.
      • appendTo

        VarList<A,​BappendTo​(A a)
        This will also return a 'new' instance of 'this' VarList interface. The difference shall be that as elements are inserted/received by the implementing software, these new elements will be placed in the list-type A 'a'.

        IMPORTANT: Instances of VarList that attempt to return array's, Stream's, or Iterator's are not compatible with this interface method. If attempting to use this 'appendTo' method with an array, Stream, or Iterator - then an 'UnsupportedOperationException' shall throw.

        Primarily, attempting to "concatenate" to one of these data-structures would generally require a new instance - and a new pointer reference. Since instantiating a new array is not consistent with the idea of "concatenation," this method shall simply throw this exception, since the pointer array-reference returned would not be the same as the one provided as a parameter here.
        Parameters:
        a - This may be any instance of the desired output return type. If 'this' instance of VarList were a VarList<Vector<String>, String>>, then one could provide a Vector<String> to this method, and list-elements would be appended to the end of the Vector 'a', rather than being inserted into a new 'Vector' instance.
        Returns:
        This shall return a new instance of 'VarList', where all elements that provided for insertion into this list shall be inserted into 'a', rather than into a newly instantiated list.
        Throws:
        OperationUnsupportedException - If parametrized-type 'A' is an instance of array, Stream, or Iterator, then this exception shall throw.
      • insert

        void insert​(B b)
        This method must accept a new element into the internally stored list.
        Parameters:
        b - The node or element being inserted into this VarList
      • retrieve

        A retrieve()
        This must retrieve or return the internally stored list.
        Returns:
        The internally stored list.
      • throwUOE

        static void throwUOE​(java.lang.String type)
                      throws java.lang.UnsupportedOperationException
        Throws:
        java.lang.UnsupportedOperationException
        Code:
        Exact Method Body:
        1
        2
        3
        4
        5
        6
        7
        8
        9
         throw new UnsupportedOperationException(
             "You have attempted an append operation to a data-type whose reference cannot be " +
             "extended using the Standard Java Memory Model.  Requested append to type: " +
             "[" + type + "] isn't possible.  " +
             "All attempts to append to an array, stream, or iterator shall result in this " +
             "exception throw.  To append to an array, stream, or iterator: use the " +
             "VarList<Stream.Builder, T>, and then build the stream.  Afterwards use " +
             "Stream.iterator(), Stream.toArray(), or the Stream itself."
         );
        
      • throwUOE2

        static void throwUOE2()
                       throws java.lang.UnsupportedOperationException
        Throws:
        java.lang.UnsupportedOperationException
        Code:
        Exact Method Body:
        1
        2
        3
        4
         throw new UnsupportedOperationException(
             "You may not use the append operation with Sort Then Apply.  The sort-information is " +
             "lost after an apply operation."
         );