Class Sets


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

      • testSetAssignment

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

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

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

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

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