Class ListBuilder<T>


  • public class ListBuilder<T>
    extends java.lang.Object
    Simple class that makes creating type safe lists of object easier
    • Constructor Summary

      Constructors 
      Constructor Description
      ListBuilder()
      Default constructor
      ListBuilder​(int initialCapacity)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ListBuilder<T> add​(java.util.Collection<T> elements)
      Adds multiple elements to the list
      ListBuilder<T> add​(T element)
      Adds a single element to the list
      ListBuilder<T> add​(T... elements)
      Adds multiple elements to the list
      java.util.List<T> build()
      Retrieves the built up list of objects
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ListBuilder

        public ListBuilder()
        Default constructor
      • ListBuilder

        public ListBuilder​(int initialCapacity)
        Constructor
        Parameters:
        initialCapacity - Initial capacity of the internal storage of the list.
    • Method Detail

      • add

        public ListBuilder<T> add​(T element)
        Adds a single element to the list
        Parameters:
        element - element to add
        Returns:
        ListBuilder
      • add

        public ListBuilder<T> add​(T... elements)
        Adds multiple elements to the list
        Parameters:
        elements - elements to add
        Returns:
        ListBuilder
      • add

        public ListBuilder<T> add​(java.util.Collection<T> elements)
        Adds multiple elements to the list
        Parameters:
        elements - elements to add
        Returns:
        ListBuilder
      • build

        public java.util.List<T> build()
        Retrieves the built up list of objects
        Returns:
        The build up list of objects