dfdfd
package host;import java.util.*;import com.sun.media.jfxmedia.events.NewFrameEvent;public class Main { public static void main(String[] args) { arraylist a=new arraylist(); a.cAdd(666); a.cPrint(); llinkedlist b=new llinkedlist(); b.lAdd(777); b.lPrint(); sset c=new sset(); c.sAdd(0); c.sPrint(); mmap m=new mmap(); m.mAdd(9, "水电费水电费水电费"); m.mPrint(); }}class arraylist{ private ListcList; public arraylist(){ cList = new LinkedList (); cList.add(2); cList.add(3); cList.add(4); cList.add(5); cList.add(6); } public void cAdd(int i){ cList.add(i); }// for (Integer integer : cList) {// System.out.println(integer);// }// System.exit(0); public void cPrint(){ for (Iterator iterator = cList.iterator(); iterator.hasNext();) {// Integer integer = (Integer) iterator.next(); System.out.println(iterator.next()); } }} class llinkedlist{ private LinkedList< Integer> llinkedlist; public llinkedlist() { // TODO Auto-generated constructor stub llinkedlist=new LinkedList<>(); llinkedlist.add(12); llinkedlist.add(13); llinkedlist.add(14); llinkedlist.add(15); llinkedlist.add(16); } public void lAdd(int n) { llinkedlist.add(n); } public void lPrint() { for (Integer in : llinkedlist) { System.out.println(in); } }}class sset{ private Set cSet; public sset() { // TODO Auto-generated constructor stub cSet = new TreeSet<>(); cSet.add(52); cSet.add(31); cSet.add(98); cSet.add(47); cSet.add(5); cSet.add(2); cSet.add(14); } public void sAdd(Integer n) { cSet.add(n); } public void sPrint() { Iterator it=cSet.iterator(); while (it.hasNext()) { Integer ii = (Integer) it.next(); System.out.println(ii); } }}class mmap{ private Map cMap; public mmap() { // TODO Auto-generated constructor stub cMap=new HashMap<>(); cMap.put(1, "gdgdgdf"); cMap.put(2, "dfgdfg451"); cMap.put(3, "qeqwejh4"); cMap.put(4, "ouiopipio"); cMap.put(5, ",mljkb"); } public void mAdd(int n,String s) { cMap.put(n, s); } public void mPrint() { for (Iterator > ents = cMap.entrySet().iterator(); ents.hasNext();) { Map.Entry ent = ents.next(); System.out.println(ent.getKey()+"---"+ent.getValue()); } }}