Java Map to String toString(Map varnames_to_Terms)

Here you can find the source of toString(Map varnames_to_Terms)

Description

Converts a substitution, in the form of a Map from variable names to Terms, to a String.

License

Open Source License

Parameter

Parameter Description
varnames_to_Terms A Map from variable names to Terms.

Return

String A String representation of the variable bindings

Declaration

public static String toString(Map varnames_to_Terms) 

Method Source Code

//package com.java2s;
// modify it under the terms of the GNU Library Public License

import java.util.Map;

public class Main {
    /**//from  ww w  .  ja  v a  2s. co  m
     * Converts a substitution, in the form of a Map from variable names to Terms, to a String.
     * 
     * @param   varnames_to_Terms  A Map from variable names to Terms.
     * @return  String             A String representation of the variable bindings
     */
    public static String toString(Map varnames_to_Terms) {
        if (varnames_to_Terms == null) {
            return "[no solution]";
        }
        java.util.Iterator varnames = varnames_to_Terms.keySet().iterator();

        String s = "Bindings: ";
        while (varnames.hasNext()) {
            String varname = (String) varnames.next();
            s += varname + "=" + varnames_to_Terms.get(varname).toString() + "; ";
        }
        return s;
    }
}

Related

  1. mapToStringList(Map map, String pairDelimiter, String listDelimiter)
  2. mapToStringMap(final Object map)
  3. toQueryString(Map ps)
  4. toStr(Map msg)
  5. toString(final Map tokens)
  6. toString(Map attributes)
  7. toString(Map map)
  8. toString(Map map)
  9. toString(Map map)