容器的打印

Posted Lqc_javaEngineer

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了容器的打印相关的知识,希望对你有一定的参考价值。

package com.itheima.testinterfacess;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.TreeMap;
import java.util.TreeSet;

/**
*
* @author Administrator
*
*/
public class PrintingContainer

static Collection fill(Collection<String> collection)
    collection.add("rat");
    collection.add("cat");
    collection.add("dog");
    collection.add("dog");
    return collection;


static Map fill(Map<String, String> map)
    map.put("rat", "rat");
    map.put("cat", "cat");
    map.put("dog", "dog");
    map.put("dog", "dog");
    return map;


public static void main(String[] args) 
    System.out.println(fill(new ArrayList<String>()));
    System.out.println(fill(new LinkedList<String>()));
    System.out.println(fill(new HashSet<String>()));
    System.out.println(fill(new TreeSet<String>()));
    System.out.println(fill(new LinkedHashSet<String>()));
    System.out.println(fill(new HashMap<String,String>()));
    System.out.println(fill(new TreeMap<String,String>()));
    System.out.println(fill(new LinkedHashMap<String,String>()));

打印结果:
[rat, cat, dog, dog]
[rat, cat, dog, dog]
[rat, cat, dog]
[cat, dog, rat]
[rat, cat, dog]
rat=rat, cat=cat, dog=dog
cat=cat, dog=dog, rat=rat
rat=rat, cat=cat, dog=dog

以上是关于容器的打印的主要内容,如果未能解决你的问题,请参考以下文章

容器打印控件对话框

布局容器打印控件

winform(容器打印对话框)

0923 容器,打印和对话框控件

容器的打印

C#_布局容器控件打印控件对话框控件