Class ArrayTool<T>

java.lang.Object
java.util.Observable
com.nomagic.magicreport.engine.Tool
com.nomagic.magicreport.engine.tools.ArrayTool<T>
Type Parameters:
T - type
All Implemented Interfaces:
ITool, IVariable, Serializable, Cloneable

@OpenApiAll public class ArrayTool<T> extends Tool
Use for creating the Array or HashSet instance.
See Also:
  • Field Details

  • Constructor Details

    • ArrayTool

      public ArrayTool()
  • Method Details

    • createArray

      public List<?> createArray()
      Create an empty ArrayList.
      Returns:
      the instance of ArrayList.
    • createArray

      public List<T> createArray(Collection<T> collection)
      Constructs an ArrayList containing the elements of the specified collection, in the order they are returned by the collection's iterator. Return ArrayList with zero size if given collection is null.
      Parameters:
      collection - the collection whose elements are to be placed into this list.
      Returns:
      an ArrayList containing the elements of the specified collection.
    • subList

      public List<List<T>> subList(List<T> list, int size)
      Create ArrayList of the portion of list in given size.
      If the size is out of bound (size <= 0 || size > list.size), the sub-list size 1 will be returned.
      Parameters:
      list - a original list.
      size - view size of given list
      Returns:
      a List of view of the specified size within given list.
    • addCollection

      public void addCollection(Collection<T> parent, Collection<T> child)
      Add child list into parent collection. It helps the template in order to handle the child is null.
      Parameters:
      parent - the parent collection.
      child - the child collection.
    • createHashSet

      public Set<?> createHashSet()
      Create HashSet instance.
      Returns:
      the instance of HashSet.