Class Lists


  • public abstract class Lists
    extends java.lang.Object
    Static helper methods and classes for lists.
    • Method Detail

      • testListAssignment

        public static AssignmentTestable.TestResult testListAssignment​(ColumnSpecification receiver,
                                                                       java.util.List<? extends AssignmentTestable> elements)
        Tests that the list with the specified elements can be assigned to the specified column.
        Parameters:
        receiver - the receiving column
        elements - the list elements
      • listToString

        public static java.lang.String listToString​(java.util.List<?> elements)
        Create a String representation of the list containing the specified elements.
        Parameters:
        elements - the list elements
        Returns:
        a String representation of the list
      • listToString

        public static <T> java.lang.String listToString​(java.lang.Iterable<T> items,
                                                        java.util.function.Function<T,​java.lang.String> mapper)
        Create a String representation of the list from the specified items associated to the list elements.
        Parameters:
        items - items associated to the list elements
        mapper - the mapper used to map the items to the String representation of the list elements
        Returns:
        a String representation of the list
      • getExactListTypeIfKnown

        public static <T> ListType<?> getExactListTypeIfKnown​(java.util.List<T> items,
                                                              java.util.function.Function<T,​AbstractType<?>> mapper)
        Returns the exact ListType from the items if it can be known.
        Parameters:
        items - the items mapped to the list elements
        mapper - the mapper used to retrieve the element types from the items
        Returns:
        the exact ListType from the items if it can be known or null
      • getPreferredCompatibleType

        public static <T> ListType<?> getPreferredCompatibleType​(java.util.List<T> items,
                                                                 java.util.function.Function<T,​AbstractType<?>> mapper)