Interface ICollectionUtil


public interface ICollectionUtil
Define common Collection operations
Since:
1.0.0
Version:
1.0.0
Author:
yui-KITAMURA
  • Method Details

    • toList

      @Contract("_ -> new") <T> List<T> toList(T... aryObj)
      Convert array to List
      Type Parameters:
      T - Type of parameters
      Parameters:
      aryObj - values array
      Returns:
      an List that contains all arguments
      See Also:
    • toArrayList

      @Contract("_ -> new") <T> ArrayList<T> toArrayList(T... aryObj)
      Convert array to ArrayList
      Type Parameters:
      T - Type of parameters
      Parameters:
      aryObj - values array
      Returns:
      an List that contains all arguments
      See Also:
    • isEmpty

      @Contract("null -> true; !null -> _;") boolean isEmpty(Object[] array)
      judge array is empty ( null or length is Zero )
      Parameters:
      array - target
      Returns:
      array is null or nothing in collection then true
    • isEmpty

      @Contract("null -> true; !null -> _;") boolean isEmpty(Collection<?> list)
      judge Collection is empty
      Parameters:
      list - target instance
      Returns:
      Collection is null or nothing in it then true
    • toString

      @Contract("null -> !null; _ -> new") String toString(Collection<?> collection)
      Format collection instance to following format.
       [entity1.toString(), entity2.toString(), ...]
       
      For example, StringBuilder then like
       [sb1sb1sb1, sb2sb2sb2]
       
      If the entity are the Collection,then call this method for recursively
      Parameters:
      collection - a collection instance that format to string
      Returns:
      single line string value
    • toString

      @Contract("null -> !null; _ -> new") String toString(Object[] array)
      Array version of toString(Collection)
      See Also:
    • toStrMeta

      @Contract("null -> !null; _ -> new") String toStrMeta(Collection<?> collection)
      Format collection instance to following format.
       {size: 2, data: [entity1.toString(), entity2.toString()]}
       
      Parameters:
      collection - a collection instance that format to string
      Returns:
      single line string value
    • toStrMeta

      @Contract("null -> !null; _ -> new") String toStrMeta(Object[] array)
      Array version of toStrMeta(Collection)
      See Also:
    • toStringBr

      @Contract("null -> !null; _ -> new") String toStringBr(Collection<?> collection)
      Format collection instance to following format.
       [
       entity1.toString(),
       entity2.toString(),
       ...
       ]
       
      For example, StringBuilder then like
       [
       sb1sb1sb1,
       sb2sb2sb2
       ]
       
      If the entity are the Collection,then call this method for recursively
      Parameters:
      collection - a collection instance that format to string
      Returns:
      multiple line string value
    • toStringBr

      @Contract("null -> !null; _ -> new") String toStringBr(Object[] array)
      Array version of toStringBr(Collection)
      See Also:
    • toStrMetaBr

      @Contract("null -> !null; _ -> new") String toStrMetaBr(Collection<?> collection)
      Format collection instance to following format.
       {
       size: 2,
       data: [
       entity1.toString(),
       entity2.toString()
       ]}
       
      Parameters:
      collection - a collection instance that format to string
      Returns:
      multiple line string value
    • toStrMetaBr

      @Contract("null -> !null; _ -> new") String toStrMetaBr(Object[] array)
      Array version of toStrMetaBr(Collection)
      See Also: