- Type Parameters:
LIST- This is the 'type' that the user would like returned from the method call. This type must be some type of container such as a list, collection, stream or possibly an array.
AN ASIDE: In classes that reside within the JDK, Generic Type-Parameters are almost always named using a singl-letter, such as
T, U, V, Retc... This choice by Oracle is not actually required, and a Type Parameter is allowed to use several characters (upper or lower case), and even numbers. The standard naming conventions don't exactly apply here since this parameterized type represens a
'Container'- for which there are no standardized Oracle Naming Conventions!
'LIST'will, in almost all cases, itself have generic-type parameters of its own. For example, if Type-Parameter
'LIST'were computed to be a
Stream<FileNode>, or possibly a
Stream<String>, the fact that
'LIST', itself, also is a Java Generic is perfectly acceptable the Java Compiler's Type-Inference Logic.
CONTENTS- This is the 'type' of the original data-structure (before any potential 'tranformations'). For instance, in the case of class
FileNode.RetTypeChoice, this shall always be type
NOTE: Unless a transformer is applied using one of the two
'CONTENTS'type will be the type that the container is holding.
public interface VarList<LIST,CONTENTS>Implementation of the
Java HTML Library Helper for Torello.Java.FileNodeCurrently, the only application for the
VarListUser-Specified Variable Return Type Interface may be found in the
Allows returns of different variations of lists from a single method.
- View Here: Torello/Java/Additional/VarList.java
- Open New Browser-Tab: Torello/Java/Additional/VarList.java
Build a new VarList Modifier and Type Method
Insert elements into a VarList Modifier and Type Method
Retrieve the List Modifier and Type Method
Internally Used Methods Modifier and Type Method
createThis returns a
- An instance of the invoking
VarList<LIST, CONTENTS>. It is expected that any internal information required, such as transforms or sorts, be preserved.
appendToThis will also return create a
'this' VarListinterface. The difference shall be that as elements are inserted/received by the implementing software, these new elements will be placed into the list passed to parameter
IMPORTANT: Instances of
VarListthat attempt to return
array's, Stream's, or
Iterator'sare not compatible with this interface method, and an
'UnsupportedOperationException'shall throw. This is because Java's syntax does not provide a simple way to extend the length of
array's, Stream's, or
list- This may be any instance of the desired output return type. If
VarList<Vector<String>, String>>, then one could provide a
Vector<String>to this method, and the ultimate effect this would have is that list-elements would be appended into
Vector 'list', rather than being added to a new
- This shall return a new instance of
'VarList', where all elements that were provided to the builder for insertion, shall be inserted into
'list', rather than into a newly instantiated list.
OperationUnsupportedException- If parametrized-type
'LIST'is an instance of
array, Stream, or
Iterator, then this exception shall throw.
insertThis method must accept a new element into the internally stored list.
contents- The node or element being inserted into this
retrieveThis must retrieve or return the internally stored list.
- The internally stored list.
static void throwUOE(java.lang.String type) throws java.lang.UnsupportedOperationException
- Exact Method Body:
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 being throwmn. 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." );
static void throwUOE2() throws java.lang.UnsupportedOperationException
- Exact Method Body:
throw new UnsupportedOperationException( "You may not use the append operation with Sort-Then-Apply. The sort-information is " + "lost after an apply operation." );