锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲不卡中文字幕,亚洲色图黄色小说,亚洲人成无码网站在线观看http://www.tkk7.com/hankchen/category/41467.htmlzh-cnThu, 14 Jan 2010 12:46:40 GMTThu, 14 Jan 2010 12:46:40 GMT60Google Collections涔婱ultimap銆丮ultisethttp://www.tkk7.com/hankchen/archive/2010/01/13/309257.htmlhankchenhankchenTue, 12 Jan 2010 16:51:00 GMThttp://www.tkk7.com/hankchen/archive/2010/01/13/309257.htmlhttp://www.tkk7.com/hankchen/comments/309257.htmlhttp://www.tkk7.com/hankchen/archive/2010/01/13/309257.html#Feedback0http://www.tkk7.com/hankchen/comments/commentRss/309257.htmlhttp://www.tkk7.com/hankchen/services/trackbacks/309257.html  1package googleCollections;
  2
  3import java.util.ArrayList;
  4import java.util.Collection;
  5import java.util.HashMap;
  6import java.util.List;
  7import java.util.Map;
  8
  9import com.google.common.collect.ArrayListMultimap;
 10import com.google.common.collect.ConcurrentHashMultiset;
 11import com.google.common.collect.Multimap;
 12import com.google.common.collect.Multiset;
 13
 14/**
 15 * Copyright (C): 2009
 16 * @author 闄堟柊姹?nbsp;http://www.tkk7.com/hankchen
 17 * @version 鍒涘緩鏃墮棿錛欽an 12, 2010 11:55:49 PM
 18 */

 19
 20/**
 21 * 妯℃嫙嫻嬭瘯鎯呭艦錛氭弿榪版瘡涓鐢熸湁澶氭湰涔︾睄
 22 * 
 23 * Multimap閫傚悎淇濆瓨鏌辯姸鍥劇殑鏁版嵁
 24 */

 25public class MultiCollectionsTest {
 26
 27    /**
 28     * @param args
 29     */

 30    public static void main(String[] args) {
 31        /**
 32         * 浠ュ墠鐨勬柟寮?br />  33         */

 34        Map<Student, List<Book>> studentBook = new HashMap<Student, List<Book>>();
 35        Student me=new Student("chenxinhan");
 36        List<Book> books=new ArrayList<Book>();
 37        books.add(new Book("璇枃"));
 38        books.add(new Book("鏁板"));
 39        studentBook.put(me,books);
 40        //閬嶅巻
 41        for(Book b:books){
 42            System.out.println(b.getName());
 43        }

 44        
 45        /**
 46         * 鐜板湪鐨勬柟寮?br />  47         */

 48        Multimap <Student,Book> newStudentBook = ArrayListMultimap.create();
 49        Student cxh=new Student("chenxinhan");
 50        newStudentBook.put(cxh,new Book("璇枃"));
 51        newStudentBook.put(cxh,new Book("鏁板"));
 52        //閬嶅巻
 53        Collection<Book> list=newStudentBook.get(cxh);
 54        for(Book b:list){
 55            System.out.println(b.getName());
 56        }

 57        
 58        /**
 59         * Multiset嫻嬭瘯
 60         * 涓嶅悓浜庝竴鑸殑Set錛孧ultiset鍙互鍏佽閲嶅鍊?br />  61         */

 62        Multiset<Book> bs=ConcurrentHashMultiset.create();
 63        Book b=new Book("Test");
 64        bs.add(b);
 65        bs.add(b);
 66        bs.add(b);
 67        for(Book ab:bs){
 68            System.out.println(ab.getName());
 69        }

 70    }

 71
 72}

 73
 74class Student{
 75    private String name;
 76    
 77    public String getName() {
 78        return name;
 79    }

 80    public void setName(String name) {
 81        this.name = name;
 82    }

 83    public Student(String name) {
 84        this.name = name;
 85    }

 86    
 87}

 88
 89class Book{
 90    private String name;
 91
 92    public String getName() {
 93        return name;
 94    }

 95
 96    public void setName(String name) {
 97        this.name = name;
 98    }

 99
100    public Book(String name) {
101        this.name = name;
102    }

103}

104
錛堝弸鎯呮彁紺猴細鏈崥鏂囩珷嬈㈣繋杞澆錛屼絾璇鋒敞鏄庡嚭澶勶細hankchen錛?a title="http://www.tkk7.com/hankchen" href="http://www.tkk7.com/hankchen">http://www.tkk7.com/hankchen錛?/strong>



hankchen 2010-01-13 00:51 鍙戣〃璇勮
]]>
Google Collections涔婭mmutable綾?/title><link>http://www.tkk7.com/hankchen/archive/2010/01/13/309255.html</link><dc:creator>hankchen</dc:creator><author>hankchen</author><pubDate>Tue, 12 Jan 2010 16:47:00 GMT</pubDate><guid>http://www.tkk7.com/hankchen/archive/2010/01/13/309255.html</guid><wfw:comment>http://www.tkk7.com/hankchen/comments/309255.html</wfw:comment><comments>http://www.tkk7.com/hankchen/archive/2010/01/13/309255.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/hankchen/comments/commentRss/309255.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/hankchen/services/trackbacks/309255.html</trackback:ping><description><![CDATA[<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080"> 1</span><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /><span style="color: #0000ff">package</span><span style="color: #000000"> googleCollections;<br /> </span><span style="color: #008080"> 2</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /><br /> </span><span style="color: #008080"> 3</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.util.ArrayList;<br /> </span><span style="color: #008080"> 4</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.util.Arrays;<br /> </span><span style="color: #008080"> 5</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.util.Collections;<br /> </span><span style="color: #008080"> 6</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.util.List;<br /> </span><span style="color: #008080"> 7</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.util.Map.Entry;<br /> </span><span style="color: #008080"> 8</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /><br /> </span><span style="color: #008080"> 9</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> com.google.common.collect.ImmutableList;<br /> </span><span style="color: #008080">10</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> com.google.common.collect.ImmutableMap;<br /> </span><span style="color: #008080">11</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> com.google.common.collect.ImmutableSet;<br /> </span><span style="color: #008080">12</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /><br /> </span><span style="color: #008080">13</span><span style="color: #000000"><img id="Codehighlighter1_306_393_Open_Image" onclick="this.style.display='none'; Codehighlighter1_306_393_Open_Text.style.display='none'; Codehighlighter1_306_393_Closed_Image.style.display='inline'; Codehighlighter1_306_393_Closed_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" /><img style="display: none" id="Codehighlighter1_306_393_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_306_393_Closed_Text.style.display='none'; Codehighlighter1_306_393_Open_Image.style.display='inline'; Codehighlighter1_306_393_Open_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" /></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_306_393_Closed_Text">/** */</span><span id="Codehighlighter1_306_393_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /> </span><span style="color: #008080">14</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /> * Copyright (C): 2009<br /> </span><span style="color: #008080">15</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /> * </span><span style="color: #808080">@author</span><span style="color: #008000"> 闄堟柊姹?nbsp;<br /> </span><span style="color: #008080">16</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /> * </span><span style="color: #808080">@version</span><span style="color: #008000"> 鍒涘緩鏃墮棿錛欽an 12, 2010 11:10:05 PM<br /> </span><span style="color: #008080">17</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" /> </span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">18</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /><br /> </span><span style="color: #008080">19</span><span style="color: #000000"><img id="Codehighlighter1_396_522_Open_Image" onclick="this.style.display='none'; Codehighlighter1_396_522_Open_Text.style.display='none'; Codehighlighter1_396_522_Closed_Image.style.display='inline'; Codehighlighter1_396_522_Closed_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" /><img style="display: none" id="Codehighlighter1_396_522_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_396_522_Closed_Text.style.display='none'; Codehighlighter1_396_522_Open_Image.style.display='inline'; Codehighlighter1_396_522_Open_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" /></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_396_522_Closed_Text">/** */</span><span id="Codehighlighter1_396_522_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /> </span><span style="color: #008080">20</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /> * 涓嶅彲鍙橀泦鍚堢被<br /> </span><span style="color: #008080">21</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /> * 閫傚悎浣滀負鍐呭鏁版嵁涓嶅彲鍙樼殑瀹瑰櫒綾?br /> </span><span style="color: #008080">22</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /> * 渚嬪錛氬父閲忔暟緇勩佸父閲廙ap絳夌瓑銆?br /> </span><span style="color: #008080">23</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /> * <br /> </span><span style="color: #008080">24</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /> * 娉ㄦ剰錛氫負浜嗗疄鐜頒笉鍙彉闆嗗悎錛孞DK 5.0閲岄潰鏄氳繃Collections.unmodifiableList(list)瀹炵幇鐨勶紒<br /> </span><span style="color: #008080">25</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" /> </span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">26</span><span style="color: #000000"><img id="Codehighlighter1_555_1600_Open_Image" onclick="this.style.display='none'; Codehighlighter1_555_1600_Open_Text.style.display='none'; Codehighlighter1_555_1600_Closed_Image.style.display='inline'; Codehighlighter1_555_1600_Closed_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" /><img style="display: none" id="Codehighlighter1_555_1600_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_555_1600_Closed_Text.style.display='none'; Codehighlighter1_555_1600_Open_Image.style.display='inline'; Codehighlighter1_555_1600_Open_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" /></span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> ImmutableListTest </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_555_1600_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_555_1600_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080">27</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    <br /> </span><span style="color: #008080">28</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">final</span><span style="color: #000000"> List</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000"> imlist; </span><span style="color: #008000">//</span><span style="color: #008000">浠ュ墠瀹炵幇錛堟柟寮忎竴錛?/span><span style="color: #008000"><br /> </span><span style="color: #008080">29</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: #000000">    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">final</span><span style="color: #000000"> List</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000"> imlist2; </span><span style="color: #008000">//</span><span style="color: #008000">浠ュ墠瀹炵幇錛堟柟寮忎簩錛?/span><span style="color: #008000"><br /> </span><span style="color: #008080">30</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: #000000">    <br /> </span><span style="color: #008080">31</span><span style="color: #000000"><img id="Codehighlighter1_677_946_Open_Image" onclick="this.style.display='none'; Codehighlighter1_677_946_Open_Text.style.display='none'; Codehighlighter1_677_946_Closed_Image.style.display='inline'; Codehighlighter1_677_946_Closed_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" /><img style="display: none" id="Codehighlighter1_677_946_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_677_946_Closed_Text.style.display='none'; Codehighlighter1_677_946_Open_Image.style.display='inline'; Codehighlighter1_677_946_Open_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" />    </span><span style="color: #0000ff">static</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_677_946_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_677_946_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080">32</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        List</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000"> list</span><span style="color: #000000">=</span><span style="color: #0000ff">new</span><span style="color: #000000"> ArrayList</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000">();<br /> </span><span style="color: #008080">33</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        list.add(</span><span style="color: #000000">"</span><span style="color: #000000">a</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> </span><span style="color: #008080">34</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        list.add(</span><span style="color: #000000">"</span><span style="color: #000000">b</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> </span><span style="color: #008080">35</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        list.add(</span><span style="color: #000000">"</span><span style="color: #000000">c</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> </span><span style="color: #008080">36</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        imlist</span><span style="color: #000000">=</span><span style="color: #000000">Collections.unmodifiableList(list); </span><span style="color: #008000">//</span><span style="color: #008000">閫氳繃榪欑鏂瑰紡瀹炵幇涓嶅彲鍙樼殑闆嗗悎,浠ュ墠瀹炵幇錛堟柟寮忎竴錛?/span><span style="color: #008000"><br /> </span><span style="color: #008080">37</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: #000000">        imlist2</span><span style="color: #000000">=</span><span style="color: #000000">Collections.unmodifiableList(Arrays.asList(</span><span style="color: #000000">"</span><span style="color: #000000">a</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">b</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">c</span><span style="color: #000000">"</span><span style="color: #000000">)); </span><span style="color: #008000">//</span><span style="color: #008000">鎴栬咃紝閫氳繃榪欑鏂瑰紡瀹炵幇涓嶅彲鍙樼殑闆嗗悎,浠ュ墠瀹炵幇錛堟柟寮忎簩錛?/span><span style="color: #008000"><br /> </span><span style="color: #008080">38</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" /></span><span style="color: #000000">    }</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">39</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /><br /> </span><span style="color: #008080">40</span><span style="color: #000000"><img id="Codehighlighter1_950_973_Open_Image" onclick="this.style.display='none'; Codehighlighter1_950_973_Open_Text.style.display='none'; Codehighlighter1_950_973_Closed_Image.style.display='inline'; Codehighlighter1_950_973_Closed_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" /><img style="display: none" id="Codehighlighter1_950_973_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_950_973_Closed_Text.style.display='none'; Codehighlighter1_950_973_Open_Image.style.display='inline'; Codehighlighter1_950_973_Open_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" />    </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_950_973_Closed_Text">/** */</span><span id="Codehighlighter1_950_973_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /> </span><span style="color: #008080">41</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />     * </span><span style="color: #808080">@param</span><span style="color: #008000"> args<br /> </span><span style="color: #008080">42</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />     </span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">43</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> main(String[] args) <br /> </span><span style="color: #008080">44</span><span style="color: #000000"><img id="Codehighlighter1_1017_1597_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1017_1597_Open_Text.style.display='none'; Codehighlighter1_1017_1597_Closed_Image.style.display='inline'; Codehighlighter1_1017_1597_Closed_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" /><img style="display: none" id="Codehighlighter1_1017_1597_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1017_1597_Closed_Text.style.display='none'; Codehighlighter1_1017_1597_Open_Image.style.display='inline'; Codehighlighter1_1017_1597_Open_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" />    </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1017_1597_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_1017_1597_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080">45</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: #008000">//</span><span style="color: #008000">甯擱噺鍒楄〃</span><span style="color: #008000"><br /> </span><span style="color: #008080">46</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: #000000">        ImmutableList</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000"> imlist</span><span style="color: #000000">=</span><span style="color: #000000">ImmutableList.of(</span><span style="color: #000000">"</span><span style="color: #000000">a</span><span style="color: #000000">"</span><span style="color: #000000">, </span><span style="color: #000000">"</span><span style="color: #000000">b</span><span style="color: #000000">"</span><span style="color: #000000">, </span><span style="color: #000000">"</span><span style="color: #000000">c</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> </span><span style="color: #008080">47</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: #008000">//</span><span style="color: #008000">imlist.add("d"); </span><span style="color: #008000">//</span><span style="color: #008000">娉ㄦ剰錛岀紪璇戜細鎶ュ紓甯?/span><span style="color: #008000"><br /> </span><span style="color: #008080">48</span><span style="color: #008000"><img id="Codehighlighter1_1147_1177_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1147_1177_Open_Text.style.display='none'; Codehighlighter1_1147_1177_Closed_Image.style.display='inline'; Codehighlighter1_1147_1177_Closed_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" /><img style="display: none" id="Codehighlighter1_1147_1177_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1147_1177_Closed_Text.style.display='none'; Codehighlighter1_1147_1177_Open_Image.style.display='inline'; Codehighlighter1_1147_1177_Open_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" /></span><span style="color: #000000">        </span><span style="color: #0000ff">for</span><span style="color: #000000">(String s:imlist)</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1147_1177_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_1147_1177_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080">49</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            System.out.println(s);<br /> </span><span style="color: #008080">50</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />        }</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">51</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        <br /> </span><span style="color: #008080">52</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: #008000">//</span><span style="color: #008000">甯擱噺Map</span><span style="color: #008000"><br /> </span><span style="color: #008080">53</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: #000000">        ImmutableMap</span><span style="color: #000000"><</span><span style="color: #000000">String,String</span><span style="color: #000000">></span><span style="color: #000000"> immap</span><span style="color: #000000">=</span><span style="color: #0000ff">new</span><span style="color: #000000"> ImmutableMap.Builder</span><span style="color: #000000"><</span><span style="color: #000000">String,String</span><span style="color: #000000">></span><span style="color: #000000">()<br /> </span><span style="color: #008080">54</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                                            .put(</span><span style="color: #000000">"</span><span style="color: #000000">a</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">1</span><span style="color: #000000">"</span><span style="color: #000000">)<br /> </span><span style="color: #008080">55</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                                            .put(</span><span style="color: #000000">"</span><span style="color: #000000">b</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">2</span><span style="color: #000000">"</span><span style="color: #000000">)<br /> </span><span style="color: #008080">56</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                                            .put(</span><span style="color: #000000">"</span><span style="color: #000000">c</span><span style="color: #000000">"</span><span style="color: #000000">, </span><span style="color: #000000">"</span><span style="color: #000000">3</span><span style="color: #000000">"</span><span style="color: #000000">)<br /> </span><span style="color: #008080">57</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                                            .build();<br /> </span><span style="color: #008080">58</span><span style="color: #000000"><img id="Codehighlighter1_1413_1469_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1413_1469_Open_Text.style.display='none'; Codehighlighter1_1413_1469_Closed_Image.style.display='inline'; Codehighlighter1_1413_1469_Closed_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" /><img style="display: none" id="Codehighlighter1_1413_1469_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1413_1469_Closed_Text.style.display='none'; Codehighlighter1_1413_1469_Open_Image.style.display='inline'; Codehighlighter1_1413_1469_Open_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" />        </span><span style="color: #0000ff">for</span><span style="color: #000000">(Entry</span><span style="color: #000000"><</span><span style="color: #000000">String,String</span><span style="color: #000000">></span><span style="color: #000000"> e:immap.entrySet())</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1413_1469_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_1413_1469_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080">59</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            System.out.println(e.getKey()</span><span style="color: #000000">+</span><span style="color: #000000">"</span><span style="color: #000000">=</span><span style="color: #000000">"</span><span style="color: #000000">+</span><span style="color: #000000">e.getValue());<br /> </span><span style="color: #008080">60</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />        }</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">61</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        <br /> </span><span style="color: #008080">62</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: #008000">//</span><span style="color: #008000">甯擱噺Set</span><span style="color: #008000"><br /> </span><span style="color: #008080">63</span><span style="color: #008000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: #000000">        ImmutableSet</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000"> imset</span><span style="color: #000000">=</span><span style="color: #000000">ImmutableSet.of(</span><span style="color: #000000">"</span><span style="color: #000000">a</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">b</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">c</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> </span><span style="color: #008080">64</span><span style="color: #000000"><img id="Codehighlighter1_1564_1594_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1564_1594_Open_Text.style.display='none'; Codehighlighter1_1564_1594_Closed_Image.style.display='inline'; Codehighlighter1_1564_1594_Closed_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" /><img style="display: none" id="Codehighlighter1_1564_1594_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1564_1594_Closed_Text.style.display='none'; Codehighlighter1_1564_1594_Open_Image.style.display='inline'; Codehighlighter1_1564_1594_Open_Text.style.display='inline';" alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" />        </span><span style="color: #0000ff">for</span><span style="color: #000000">(String s:imset)</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1564_1594_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_1564_1594_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080">65</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            System.out.println(s);<br /> </span><span style="color: #008080">66</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />        }</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">67</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />    }</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">68</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /><br /> </span><span style="color: #008080">69</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" />}</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">70</span><span style="color: #000000"><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /></span></div> <br /> 錛堝弸鎯呮彁紺猴細鏈崥鏂囩珷嬈㈣繋杞澆錛屼絾璇鋒敞鏄庡嚭澶勶細hankchen錛?a title="http://www.tkk7.com/hankchen" href="http://www.tkk7.com/hankchen"><strong>http://www.tkk7.com/hankchen</strong></a><strong>錛?/strong><br /> <br /> <img src ="http://www.tkk7.com/hankchen/aggbug/309255.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/hankchen/" target="_blank">hankchen</a> 2010-01-13 00:47 <a href="http://www.tkk7.com/hankchen/archive/2010/01/13/309255.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>闈欐佸唴閮ㄧ被http://www.tkk7.com/hankchen/archive/2010/01/05/308310.htmlhankchenhankchenTue, 05 Jan 2010 09:25:00 GMThttp://www.tkk7.com/hankchen/archive/2010/01/05/308310.htmlhttp://www.tkk7.com/hankchen/comments/308310.htmlhttp://www.tkk7.com/hankchen/archive/2010/01/05/308310.html#Feedback0http://www.tkk7.com/hankchen/comments/commentRss/308310.htmlhttp://www.tkk7.com/hankchen/services/trackbacks/308310.html闃呰鍏ㄦ枃

hankchen 2010-01-05 17:25 鍙戣〃璇勮
]]>
涓閬揓ava澶氱嚎紼嬮潰璇曢鐨勮В絳?/title><link>http://www.tkk7.com/hankchen/archive/2009/12/29/307680.html</link><dc:creator>hankchen</dc:creator><author>hankchen</author><pubDate>Tue, 29 Dec 2009 12:58:00 GMT</pubDate><guid>http://www.tkk7.com/hankchen/archive/2009/12/29/307680.html</guid><wfw:comment>http://www.tkk7.com/hankchen/comments/307680.html</wfw:comment><comments>http://www.tkk7.com/hankchen/archive/2009/12/29/307680.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/hankchen/comments/commentRss/307680.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/hankchen/services/trackbacks/307680.html</trackback:ping><description><![CDATA[<span style="font-size: 12pt; font-family: 瀹嬩綋"><br /> 鏈榪戠湅鍒頒竴閬撻潰璇曢錛屾瘮杈冩湁鎰忔濓細</span> <br /> <p><span style="font-size: 12pt; font-family: 瀹嬩綋"><br /> 鏈変笁涓嚎紼?/span><span style="font-size: 12pt; font-family: 'Times New Roman','serif'">ID</span><span style="font-size: 12pt; font-family: 瀹嬩綋">鍒嗗埆鏄?/span><span style="font-size: 12pt; font-family: 'Times New Roman','serif'">A</span><span style="font-size: 12pt; font-family: 瀹嬩綋">銆?/span><span style="font-size: 12pt; font-family: 'Times New Roman','serif'">B</span><span style="font-size: 12pt; font-family: 瀹嬩綋">銆?/span><span style="font-size: 12pt; font-family: 'Times New Roman','serif'">C,</span><span style="font-size: 12pt; font-family: 瀹嬩綋">璇鋒湁澶氱嚎緙栫▼瀹炵幇錛屽湪灞忓箷涓婂驚鐜墦鍗?/span><span style="font-size: 12pt; font-family: 'Times New Roman','serif'">10</span><span style="font-size: 12pt; font-family: 瀹嬩綋">嬈?/span><span style="font-size: 12pt; font-family: 'Times New Roman','serif'">ABCABC…</span></p> <p><span style="font-size: 12pt; font-family: 瀹嬩綋">鐢變簬綰跨▼鎵ц鐨勪笉紜畾鎬э紝瑕佷繚璇佽繖鏍鋒湁搴忕殑杈撳嚭錛屽繀欏繪帶鍒跺ソ澶氱嚎紼嬬殑鍚屾銆?br /> <br /> </span></p> <p><span style="font-size: 12pt; font-family: 瀹嬩綋">綰跨▼鍚屾鏈変袱縐嶅熀鏈柟娉曪細</span></p> <p style="margin-left: 36pt; text-indent: -36pt"><span style="font-size: 12pt; font-family: 'Times New Roman','serif'">錛?錛?span style="font: 7pt 'Times New Roman'">    </span></span><span style="font-size: 12pt; font-family: 'Times New Roman','serif'">synchronized</span></p> <p style="margin-left: 36pt; text-indent: -36pt"><span style="font-size: 12pt; font-family: 'Times New Roman','serif'">錛?錛?span style="font: 7pt 'Times New Roman'">    </span></span><span style="font-size: 12pt; font-family: 'Times New Roman','serif'">wait,notify,notifyAll</span></p> <p><span style="font-size: 12pt; font-family: 瀹嬩綋">鐜板湪鍒嗗埆閲囩敤榪欎袱縐嶆柟娉曟潵瑙g瓟榪欓亾棰樼洰銆?/span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">/**</span></p> <p style="text-indent: 6pt; text-align: left" align="left"><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">* </span><strong><span style="font-size: 12pt; color: #7f9fbf; font-family: 'Times New Roman','serif'">@author</span></strong><span style="font-size: 12pt; color: #3f5fbf; font-family: 瀹嬩綋">闄堟柊姹?<font style="background-color: #cce8cf">http://www.tkk7.com/hankchen</font></span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'"> * 2009</span><span style="font-size: 12pt; color: #7f7f9f; font-family: 'Times New Roman','serif'">-</span><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">12</span><span style="font-size: 12pt; color: #7f7f9f; font-family: 'Times New Roman','serif'">-</span><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">28 </span><span style="font-size: 12pt; color: #3f5fbf; font-family: 瀹嬩綋">涓嬪崍</span><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">01:57:04<br /> </span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'"> */</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">/**</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'"> *</span><span style="font-size: 12pt; color: #3f5fbf; font-family: 瀹嬩綋">閲囩敤澶氱嚎紼嬫妧鏈墦鍗?/span><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">10</span><span style="font-size: 12pt; color: #3f5fbf; font-family: 瀹嬩綋">嬈?/span><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">“ABC”</span><span style="font-size: 12pt; color: #3f5fbf; font-family: 瀹嬩綋">錛屽嵆</span><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">“</span><span style="font-size: 12pt; color: #3f5fbf; font-family: 瀹嬩綋">錛★饑錛o肌錛跡</span><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">...”</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'"> * </span><span style="font-size: 12pt; color: #3f5fbf; font-family: 瀹嬩綋">瀹炵幇鏂瑰紡錛堜竴錛夊埄鐢?/span><u><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">synchronized</span></u><span style="font-size: 12pt; color: #3f5fbf; font-family: 瀹嬩綋">鍏抽敭瀛楀疄鐜?/span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'"> */</span></p> <p style="text-align: left" align="left"><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">public </span></strong><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">class</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiInterviewMultithread {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">/**</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">        * </span><strong><span style="font-size: 12pt; color: #7f9fbf; font-family: 'Times New Roman','serif'">@param</span></strong><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'"> <span style="background: silver">args</span></span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: #3f5fbf; font-family: 'Times New Roman','serif'">        */</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">public </span></strong><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">static </span></strong><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">void</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> main(String[] <span style="background: yellow">args</span>) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              XunleiLock lock = </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">new</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiLock();</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">new</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> Thread(</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">new</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiPrinter(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"A"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">, lock)).start();</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">new</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> Thread(</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">new</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiPrinter(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"B"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">, lock)).start();</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">new</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> Thread(</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">new</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiPrinter(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"C"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">, lock)).start();</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">}</span></p> <p style="text-align: left" align="left"><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">class</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiPrinter </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">implements</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> Runnable {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">private</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> String </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> = </span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">""</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">private</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiLock </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> = </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">null</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">private </span></strong><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">int </span></strong><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">count</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">=10;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">public</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiPrinter(String name, XunleiLock lock) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> = name;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> = lock;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><span style="font-size: 12pt; color: #646464; font-family: 'Times New Roman','serif'">@Override</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">public </span></strong><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">void</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> run() {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">while</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">(</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">count</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">>0) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                     </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">synchronized</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> (</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                            </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">if</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> (</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.getName().equalsIgnoreCase(</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">)) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   System.</span><em><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">out</span></em><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.print(</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">);</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">count</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">--;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">if</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> (</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.equals(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"A"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">)) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                          </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.setName(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"B"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">);</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   } </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">else</span></strong><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">if</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> (</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.equals(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"B"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">)) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                          </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.setName(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"C"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">);</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   } </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">else</span></strong><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">if</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> (</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.equals(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"C"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">)) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                          </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.setName(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"A"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">);</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                            }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                     }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">}</span></p> <p style="text-align: left" align="left"><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">class</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiLock </span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">{</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">public</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> String </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> = </span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"A"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">public</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> String getName() {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">return </span></strong><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">public</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">void</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> setName(String name) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> = name;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       }</span></p> <p><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">}</span></p> <p><span style="font-size: 12pt; color: black; font-family: 瀹嬩綋">鏂規硶錛堜簩錛?/span><span style="font-size: 12pt; color: black; font-family: 瀹嬩綋">綰跨▼綾諱慨鏀瑰涓嬶紝鍏朵粬綾諱竴鏍鳳細</span></p> <p style="text-align: left" align="left"><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">class</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiPrinter2 </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">implements</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> Runnable {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">private</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> String </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> = </span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">""</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">private</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiLock </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> = </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">null</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">private </span></strong><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">int </span></strong><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">count</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">=10;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">public</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> XunleiPrinter2(String name, XunleiLock lock) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> = name;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> = lock;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><span style="font-size: 12pt; color: #646464; font-family: 'Times New Roman','serif'">@Override</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">public </span></strong><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">void</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> run() {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">while</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">(</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">count</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">>0) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                     </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">synchronized</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> (</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                            </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">while</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">(!</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.getName().equalsIgnoreCase(</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">)) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">try</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">{</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                          </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.wait();</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   }</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">catch</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">(InterruptedException e){</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                          e.printStackTrace();</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                            }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                            System.</span><em><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">out</span></em><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.print(</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">);</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                            </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">count</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">--;</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                            </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">if</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> (</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.equals(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"A"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">)) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.setName(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"B"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">);</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                            } </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">else</span></strong><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">if</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> (</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.equals(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"B"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">)) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.setName(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"C"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">);</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                            } </span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">else</span></strong><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">if</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'"> (</span><strong><span style="font-size: 12pt; color: #7f0055; font-family: 'Times New Roman','serif'">this</span></strong><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.</span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">name</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.equals(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"C"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">)) {</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                                   </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.setName(</span><span style="font-size: 12pt; color: #2a00ff; font-family: 'Times New Roman','serif'">"A"</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">);</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                            }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                            </span><span style="font-size: 12pt; color: #0000c0; font-family: 'Times New Roman','serif'">lock</span><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">.notifyAll();</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">                     }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">              }</span></p> <p style="text-align: left" align="left"><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">       }</span></p> <p><span style="font-size: 12pt; color: black; font-family: 'Times New Roman','serif'">}</span></p> <span style="font-size: 12pt; font-family: 瀹嬩綋">錛堝弸鎯呮彁紺猴細鏈崥鏂囩珷嬈㈣繋杞澆錛屼絾璇鋒敞鏄庡嚭澶勶細闄堟柊姹夛紝<a title="http://www.tkk7.com/hankchen" href="http://www.tkk7.com/hankchen">http://www.tkk7.com/hankchen</a>錛?br /> </span> <img src ="http://www.tkk7.com/hankchen/aggbug/307680.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/hankchen/" target="_blank">hankchen</a> 2009-12-29 20:58 <a href="http://www.tkk7.com/hankchen/archive/2009/12/29/307680.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://vvbbn.com" target="_blank">日韩精品无码一区二区三区免费</a>| <a href="http://www-8908.com" target="_blank">xxxx日本免费</a>| <a href="http://400209.com" target="_blank">亚洲高清日韩精品第一区 </a>| <a href="http://zndijgch.com" target="_blank">国内精品免费视频自在线</a>| <a href="http://eldadhagar.com" target="_blank">免费国产a理论片</a>| <a href="http://527352.com" target="_blank">精品日韩亚洲AV无码一区二区三区</a>| <a href="http://juguanghr.com" target="_blank">成年女人免费视频播放体验区</a>| <a href="http://shmtweld.com" target="_blank">国产精品视频全国免费观看</a>| <a href="http://732r.com" target="_blank">亚洲国产日韩在线成人蜜芽</a>| <a href="http://youyou8tv.com" target="_blank">又粗又大又长又爽免费视频</a>| <a href="http://fdhkauto.com" target="_blank">久久w5ww成w人免费</a>| <a href="http://z88d.com" target="_blank">未满十八私人高清免费影院</a>| <a href="http://fzgjw.com" target="_blank">亚洲伊人久久精品</a>| <a href="http://dazngt.com" target="_blank">亚洲色中文字幕无码AV</a>| <a href="http://yy975.com" target="_blank">成人午夜视频免费</a>| <a href="http://3344by.com" target="_blank">久久久精品免费视频</a>| <a href="http://szicon.com" target="_blank">国产成人综合亚洲一区</a>| <a href="http://takiku.com" target="_blank">91精品国产亚洲爽啪在线观看</a>| <a href="http://fenglufzjx.com" target="_blank">国产午夜影视大全免费观看</a>| <a href="http://www-3499.com" target="_blank">最好看最新的中文字幕免费</a>| <a href="http://mogo321.com" target="_blank">免费一级特黄特色大片</a>| <a href="http://ivy-fund.com" target="_blank">久久精品国产亚洲AV久</a>| <a href="http://ax445.com" target="_blank">国产亚洲A∨片在线观看</a>| <a href="http://yuduruizhi.com" target="_blank">宅男666在线永久免费观看</a>| <a href="http://600c81.com" target="_blank">久久免费的精品国产V∧</a>| <a href="http://hzsprfm.com" target="_blank">丰满少妇作爱视频免费观看</a>| <a href="http://606059.com" target="_blank">亚洲一区二区三区亚瑟</a>| <a href="http://ddxsrd.com" target="_blank">亚洲成色www久久网站夜月</a>| <a href="http://pgb168.com" target="_blank">国产又大又黑又粗免费视频</a>| <a href="http://513573.com" target="_blank">2021久久精品免费观看</a>| <a href="http://www-92109.com" target="_blank">精品国产麻豆免费人成网站</a>| <a href="http://5s6b.com" target="_blank">欧洲亚洲综合一区二区三区</a>| <a href="http://0769wwt.com" target="_blank">亚洲avav天堂av在线网爱情</a>| <a href="http://bj-tkld.com" target="_blank">婷婷久久久亚洲欧洲日产国码AV</a>| <a href="http://88533066.com" target="_blank">亚洲精品国产电影</a>| <a href="http://xyyfamily.com" target="_blank">日韩免费无码一区二区视频</a>| <a href="http://jioupin.com" target="_blank">福利免费观看午夜体检区</a>| <a href="http://34pmpm.com" target="_blank">97在线视频免费播放</a>| <a href="http://chuadang.com" target="_blank">最近的2019免费中文字幕</a>| <a href="http://deyingwh.com" target="_blank">成人嫩草影院免费观看</a>| <a href="http://jl910.com" target="_blank">国产亚洲Av综合人人澡精品</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>