Example usage for java.util Map toString

List of usage examples for java.util Map toString

Introduction

In this page you can find the example usage for java.util Map toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:Main.java

public static void main(String[] args) {
    List<String> aList = new ArrayList<String>();
    Map<Integer, String> aMap = new HashMap<Integer, String>();
    aList.add("A");
    aList.add("B");

    for (int i = 0; i < aList.size(); i++) {
        aMap.put(i + 1, aList.get(i));//w  ww . ja  va  2  s .c  o m
    }

    System.out.println(aMap.toString());
}

From source file:Main.java

public static void main(String[] args) {
    Map<String, String> map = new HashMap<>();
    map.put("CSS", "style");
    map.put("HTML", "mark up");
    map.put("Oracle", "database");
    map.put("XML", "data");

    System.out.println("Map: " + map.toString());

    listValues(map);/*  w ww.  j a  v a  2s.  co  m*/
    listEntries(map);
}

From source file:net.itransformers.bgpPeeringMap.BgpPeeringMapFromFile.java

public static void main(String[] args) throws Exception {

    Map<String, String> params = CmdLineParser.parseCmdLine(args);
    logger.info("input params" + params.toString());
    final String settingsFile = params.get("-s");
    if (settingsFile == null) {
        printUsage("bgpPeeringMap.properties");
        return;/*from  w  w w .  j a  va  2  s  . com*/
    }

    Map<String, String> settings = loadProperties(new File(System.getProperty("base.dir"), settingsFile));
    logger.info("Settings" + settings.toString());

    File outputDir = new File(System.getProperty("base.dir"), settings.get("output.dir"));
    System.out.println(outputDir.getAbsolutePath());
    boolean result = outputDir.mkdir();
    //        if (!result) {
    //            System.out.println("result:"+result);
    //            System.out.println("Unable to create dir: "+outputDir);
    //            return;
    //        }

    File graphmlDir = new File(outputDir, settings.get("output.dir.graphml"));
    result = outputDir.mkdir();
    //        if (!result) {
    //            System.out.println("Unable to create dir: "+graphmlDir);
    //            return;
    //        }

    XsltTransformer transformer = new XsltTransformer();
    byte[] rawData = readRawDataFile(settings.get("raw-data-file"));
    logger.info("First-transformation has started with xsltTransformator " + settings.get("xsltFileName1"));

    ByteArrayOutputStream outputStream1 = new ByteArrayOutputStream();
    File xsltFileName1 = new File(System.getProperty("base.dir"), settings.get("xsltFileName1"));
    ByteArrayInputStream inputStream1 = new ByteArrayInputStream(rawData);
    // transformer.transformXML(inputStream1, xsltFileName1, outputStream1, settings);
    logger.info("First transformation finished");
    File outputFile1 = new File(graphmlDir, "bgpPeeringMap-intermediate.xml");

    FileUtils.writeStringToFile(outputFile1, new String(outputStream1.toByteArray()));

    logger.info("Second transformation started with xsltTransformator " + settings.get("xsltFileName2"));

    ByteArrayOutputStream outputStream2 = new ByteArrayOutputStream();
    File xsltFileName2 = new File(System.getProperty("base.dir"), settings.get("xsltFileName2"));
    ByteArrayInputStream inputStream2 = new ByteArrayInputStream(outputStream1.toByteArray());
    // transformer.transformXML(inputStream2, xsltFileName2, outputStream2, settings);
    logger.info("Second transformation finished");
    File outputFile = new File(graphmlDir, "bgpPeeringMap.graphml");
    File nodesFileListFile = new File(graphmlDir, "nodes-file-list.txt");
    FileUtils.writeStringToFile(outputFile, new String(outputStream2.toByteArray()));
    logger.info("Output Graphml saved in a file in" + graphmlDir);

    FileUtils.writeStringToFile(nodesFileListFile, "bgpPeeringMap.graphml");

    ByteArrayInputStream inputStream3 = new ByteArrayInputStream(outputStream2.toByteArray());
    ByteArrayOutputStream outputStream3 = new ByteArrayOutputStream();
    File xsltFileName3 = new File(System.getProperty("base.dir"), settings.get("xsltFileName3"));
    // transformer.transformXML(inputStream3, xsltFileName3, outputStream3);

}

From source file:net.itransformers.bgpPeeringMap.BgpPeeringMap.java

public static void main(String[] args) throws Exception {

    Map<String, String> params = CmdLineParser.parseCmdLine(args);
    logger.info("input params" + params.toString());
    final String settingsFile = params.get("-s");
    if (settingsFile == null) {
        printUsage("bgpPeeringMap.properties");
        return;// w ww . j av  a 2  s .c o m
    }

    discover();

}

From source file:com.hesine.manager.generate.Generate.java

public static void main(String[] args) throws Exception {
    File projectPath = new DefaultResourceLoader().getResource("").getFile();
    //        Generate.execute(projectPath);

    // //from w  ww .j av a2  s .  com
    String packageName = "com.hesine.manager";
    String moduleName = "";

    // ?
    List<Map<String, String>> list = DBOperator.getTables("tb_");
    for (Map<String, String> a : list) {
        System.out.println(a.toString());
        if (a.get("tableName").equals("tb_userinfo")) {
            List<Map<String, String>> listTC = DBOperator.getTableColumns(a.get("tableName"));
            // ?
            for (Map<String, String> b : listTC) {
                System.out.println(b.toString());
                for (String key : b.keySet()) {
                    System.out.println(key + " : " + b.get(key));
                }

            }
            Generate.execute(projectPath, packageName, moduleName, a, listTC);
            break;
        }
    }

}

From source file:com.apress.prospringintegration.transform.SerializerTransformer.java

public static void main(String[] args) {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
            "classpath:serializer-transformer.xml");

    MessageChannel input = context.getBean("input", MessageChannel.class);
    PollableChannel output = context.getBean("output", PollableChannel.class);

    Map<String, String> customerMap = new HashMap<String, String>();
    customerMap.put("firstName", "John");
    customerMap.put("lastName", "Smith");
    customerMap.put("address", "100 State Street");
    customerMap.put("city", "Los Angeles");
    customerMap.put("state", "CA");
    customerMap.put("zip", "90064");

    System.out.println("toString(): " + customerMap.toString());

    Message<Map<String, String>> message = MessageBuilder.withPayload(customerMap).build();
    input.send(message);/*from   w  w  w  .j  ava  2 s .c  o m*/

    Message<?> reply = output.receive();
    System.out.println("received: " + reply.getPayload());
}

From source file:com.apress.prospringintegration.transform.ToStringTransformer.java

public static void main(String[] args) {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
            "classpath:string-transformer.xml");

    MessageChannel input = context.getBean("input", MessageChannel.class);
    PollableChannel output = context.getBean("output", PollableChannel.class);

    Map<String, String> customerMap = new HashMap<String, String>();
    customerMap.put("firstName", "John");
    customerMap.put("lastName", "Smith");
    customerMap.put("address", "100 State Street");
    customerMap.put("city", "Los Angeles");
    customerMap.put("state", "CA");
    customerMap.put("zip", "90064");

    System.out.println("toString(): " + customerMap.toString());

    Message<Map<String, String>> message = MessageBuilder.withPayload(customerMap).build();
    input.send(message);//from ww  w  .j  a  va 2  s  .  c o  m

    Message<?> reply = output.receive();
    System.out.println("received: " + reply.getPayload());
}

From source file:Main.java

public static <K, V> String mapToString(Map<K, V> map) {
    if (map == null)
        return null;
    return map.toString();
}

From source file:com.roncoo.jui.common.util.HttpUtil.java

public static JsonNode postForObject(String url, Map<String, Object> map) {
    logger.info("POST  url={}map={}", url, map.toString());
    return restTemplate.postForObject(url, map, JsonNode.class);
}

From source file:com.vivastream.dynamodb.core.DynamoDBTemplate.java

private static String renderKey(Map<String, ?> key) {
    return key.toString();
}