Class Maps


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

      • mapToString

        public static <T> java.lang.String mapToString​(java.util.List<Pair<T,​T>> entries)
        Create a String representation of the list containing the specified elements.
        Parameters:
        entries - the list elements
        Returns:
        a String representation of the list
      • mapToString

        public static <T> java.lang.String mapToString​(java.util.List<Pair<T,​T>> items,
                                                       java.util.function.Function<T,​java.lang.String> mapper)
        Create a String representation of the map from the specified items associated to the map entries.
        Parameters:
        items - items associated to the map entries
        mapper - the mapper used to map the items to the String representation of the map entries
        Returns:
        a String representation of the map
      • getExactMapTypeIfKnown

        public static <T> MapType<?,​?> getExactMapTypeIfKnown​(java.util.List<Pair<T,​T>> entries,
                                                                    java.util.function.Function<T,​AbstractType<?>> mapper)
        Returns the exact MapType from the entries if it can be known.
        Parameters:
        entries - the entries
        mapper - the mapper used to retrieve the key and value types from the entries
        Returns:
        the exact MapType from the entries if it can be known or null
      • getPreferredCompatibleType

        public static <T> MapType<?,​?> getPreferredCompatibleType​(java.util.List<Pair<T,​T>> entries,
                                                                        java.util.function.Function<T,​AbstractType<?>> mapper)