锘??xml version="1.0" encoding="utf-8" standalone="yes"?>午夜亚洲乱码伦小说区69堂,亚洲另类春色校园小说,亚洲桃色AV无码http://www.tkk7.com/tfzhu/category/45031.html姣忓ぉ榪涙涓鐐圭偣錛?/description>zh-cnSun, 25 Jul 2010 06:08:41 GMTSun, 25 Jul 2010 06:08:41 GMT60DateUtilshttp://www.tkk7.com/tfzhu/archive/2010/07/25/327062.html鏂偣鏂偣Sun, 25 Jul 2010 03:02:00 GMThttp://www.tkk7.com/tfzhu/archive/2010/07/25/327062.htmlhttp://www.tkk7.com/tfzhu/comments/327062.htmlhttp://www.tkk7.com/tfzhu/archive/2010/07/25/327062.html#Feedback0http://www.tkk7.com/tfzhu/comments/commentRss/327062.htmlhttp://www.tkk7.com/tfzhu/services/trackbacks/327062.htmlDateUtils.compareYear(regDate, base.getTInsrncBgnTm()) // 鏂版棫杞︽爣蹇椼愪繚闄╄搗鏈?- 鍒濈櫥騫存湀銆?鍗曚綅錛氬勾

鏂偣 2010-07-25 11:02 鍙戣〃璇勮
]]>
StringUtilshttp://www.tkk7.com/tfzhu/archive/2010/05/30/322262.html鏂偣鏂偣Sun, 30 May 2010 02:46:00 GMThttp://www.tkk7.com/tfzhu/archive/2010/05/30/322262.htmlhttp://www.tkk7.com/tfzhu/comments/322262.htmlhttp://www.tkk7.com/tfzhu/archive/2010/05/30/322262.html#Feedback0http://www.tkk7.com/tfzhu/comments/commentRss/322262.htmlhttp://www.tkk7.com/tfzhu/services/trackbacks/322262.html--欏圭洰涓殑鐢ㄦ硶銆?br /> 1銆丼tringUtils.join
List dwVoListInTab = this.prodService.getPicTabVOList(picId);
List dwNameListInTab = new ArrayList();
        for (PrdTabVO dwVo : dwVoListInTab) {
          String dwName = this.prodService.cvtTabNo2DWName(useProdNo, picId,
            dwVo.getCTabNo());
          dwNameListInTab.add(dwName);
          dwNameMap.put(dwVo.getCNmeEn(), dwName);
        }
        ((List)plyDwNameList).addAll(dwNameListInTab);

String dwNameListStr = "['" + StringUtils.join(dwNameListInTab.toArray(), "','") + "']";
鍏跺畠錛?br /> StringUtils.join(new String[]{"cat","dog","carrot","leaf","door"}, ":")
// cat:dog:carrot:leaf:door

2銆丼tringUtils.isNotEmpty    //Checks if a String is not empty ("") and not null.

if (StringUtils.isNotEmpty(onload)) 
          onload = sub.replace(onload);
        else {
          onload = "";
        }

public String replace(char oldChar,char newChar)榪斿洖涓涓柊鐨勫瓧絎︿覆錛屽畠鏄氳繃鐢?newChar 鏇?/span>鎹㈡瀛楃涓蹭腑鍑虹幇鐨勬墍鏈?oldChar 寰楀埌鐨勩?
濡傛灉 oldChar 鍦ㄦ String 瀵硅薄琛ㄧず鐨勫瓧絎﹀簭鍒椾腑娌℃湁鍑虹幇錛屽垯榪斿洖瀵規 String 瀵硅薄鐨勫紩鐢ㄣ?br />

3銆丼tringUtils.equals    //StringUtils.equals(null, null)   = true
 if (!StringUtils.equals(prodKindNo, "00")) {
}

4銆丼tringUtils.isBlank     //Checks if a String is whitespace, empty ("") or null.
if (StringUtils.isBlank(taskId))
        jsBuffer.append("var taskId='';\n");
      else {
        jsBuffer.append("var taskId='" + taskId + "';\n");
      }

 
5銆丼tringUtils.leftPad(String str, int size,String padStr) --宸﹀~鍏?br /> //鎶曚繚騫村害銆愪繚闄╄搗鏈?- 鍒濈櫥騫存湀銆?鍗曚綅錛氬勾
String ply_year = StringUtils.leftPad(String.valueOf(DateUtils.compareYear(regDate,base.getTInsrncBgnTm())), 2, '0'); 
 
/**
4260         * <p>Left pad a String with a specified String.</p>
4261         *
4262         * <p>Pad to a size of <code>size</code>.</p>
4263         *
4264         * <pre>
4265         * StringUtils.leftPad(null, *, *)      = null
4266         * StringUtils.leftPad("", 3, "z")      = "zzz"
4267         * StringUtils.leftPad("bat", 3, "yz")  = "bat"
4268         * StringUtils.leftPad("bat", 5, "yz")  = "yzbat"
4269         * StringUtils.leftPad("bat", 8, "yz")  = "yzyzybat"
4270         * StringUtils.leftPad("bat", 1, "yz")  = "bat"
4271         * StringUtils.leftPad("bat", -1, "yz") = "bat"
4272         * StringUtils.leftPad("bat", 5, null)  = "  bat"
4273         * StringUtils.leftPad("bat", 5, "")    = "  bat"
4274         * </pre>
4275         *
4276         * @param str  the String to pad out, may be null
4277         * @param size  the size to pad to
4278         * @param padStr  the String to pad with, null or empty treated as single space
4279         * @return left padded String or original String if no padding is necessary,
4280         *  <code>null</code> if null String input
4281         */
4282        public static String leftPad(String str, int size, String padStr) {
4283            if (str == null) {
4284                return null;
4285            }
4286            if (isEmpty(padStr)) {
4287                padStr = " ";
4288            }
4289            int padLen = padStr.length();
4290            int strLen = str.length();
4291            int pads = size - strLen;
4292            if (pads <= 0) {
4293                return str; // returns original String when possible
4294            }
4295            if (padLen == 1 && pads <= PAD_LIMIT) {
4296                return leftPad(str, size, padStr.charAt(0));
4297            }
4298   
4299            if (pads == padLen) {
4300                return padStr.concat(str);
4301            } else if (pads < padLen) {
4302                return padStr.substring(0, pads).concat(str);
4303            } else {
4304                char[] padding = new char[pads];
4305                char[] padChars = padStr.toCharArray();
4306                for (int i = 0; i < pads; i++) {
4307                    padding[i] = padChars[i % padLen];
4308                }
4309                return new String(padding).concat(str);
4310            }
4311        }


---------------------------------------------


璇﹁錛歨ttp://commons.apache.org/lang/api/org/apache/commons/lang/StringUtils.html

isEmpty
public static boolean isEmpty(CharSequence str)
Checks if a String is empty ("") or null.

 StringUtils.isEmpty(null)      = true
StringUtils.isEmpty("")        = true
StringUtils.isEmpty(" ")       = false
StringUtils.isEmpty("bob")     = false
StringUtils.isEmpty("  bob  ") = false

NOTE: This method changed in Lang version 2.0. It no longer trims the String. That

functionality is available in isBlank().

 

Parameters:
str - the String to check, may be null
Returns:
true if the String is empty or null


isNotEmpty
public static boolean isNotEmpty(CharSequence str)
Checks if a String is not empty ("") and not null.

 StringUtils.isNotEmpty(null)      = false
StringUtils.isNotEmpty("")        = false
StringUtils.isNotEmpty(" ")       = true
StringUtils.isNotEmpty("bob")     = true
StringUtils.isNotEmpty("  bob  ") = true

 

Parameters:
str - the String to check, may be null
Returns:
true if the String is not empty and not null


isBlank
public static boolean isBlank(CharSequence str)
Checks if a String is whitespace, empty ("") or null.

 StringUtils.isBlank(null)      = true
StringUtils.isBlank("")        = true
StringUtils.isBlank(" ")       = true
StringUtils.isBlank("bob")     = false
StringUtils.isBlank("  bob  ") = false

 

Parameters:
str - the String to check, may be null
Returns:
true if the String is null, empty or whitespace
Since:
2.0


isNotBlank
public static boolean isNotBlank(CharSequence str)
Checks if a String is not empty (""), not null and not whitespace only.

 StringUtils.isNotBlank(null)      = false
StringUtils.isNotBlank("")        = false
StringUtils.isNotBlank(" ")       = false
StringUtils.isNotBlank("bob")     = true
StringUtils.isNotBlank("  bob  ") = true

 

Parameters:
str - the String to check, may be null
Returns:
true if the String is not empty and not null and not whitespace
Since:
2.0


trim
public static String trim(String str)
Removes control characters (char <= 32) from both ends of this String, handling null by

returning null.

The String is trimmed using String.trim(). Trim removes start and end characters <= 32.

To strip whitespace use strip(String).

To trim your choice of characters, use the strip(String, String) methods.

 StringUtils.trim(null)          = null
StringUtils.trim("")            = ""
StringUtils.trim("     ")       = ""
StringUtils.trim("abc")         = "abc"
StringUtils.trim("    abc    ") = "abc"

 

Parameters:
str - the String to be trimmed, may be null
Returns:
the trimmed string, null if null String input


trimToNull
public static String trimToNull(String str)
Removes control characters (char <= 32) from both ends of this String returning null if

the String is empty ("") after the trim or if it is null.

The String is trimmed using String.trim(). Trim removes start and end characters <= 32.

To strip whitespace use stripToNull(String).

 StringUtils.trimToNull(null)          = null
StringUtils.trimToNull("")            = null
StringUtils.trimToNull("     ")       = null
StringUtils.trimToNull("abc")         = "abc"
StringUtils.trimToNull("    abc    ") = "abc"

 

Parameters:
str - the String to be trimmed, may be null
Returns:
the trimmed String, null if only chars <= 32, empty or null String input
Since:
2.0


trimToEmpty
public static String trimToEmpty(String str)
Removes control characters (char <= 32) from both ends of this String returning an empty

String ("") if the String is empty ("") after the trim or if it is null.

The String is trimmed using String.trim(). Trim removes start and end characters <= 32.

To strip whitespace use stripToEmpty(String).

 StringUtils.trimToEmpty(null)          = ""
StringUtils.trimToEmpty("")            = ""
StringUtils.trimToEmpty("     ")       = ""
StringUtils.trimToEmpty("abc")         = "abc"
StringUtils.trimToEmpty("    abc    ") = "abc"

 

Parameters:
str - the String to be trimmed, may be null
Returns:
the trimmed String, or an empty String if null input
Since:
2.0
equals
public static boolean equals(String str1,
String str2)
Compares two Strings, returning true if they are equal.

nulls are handled without exceptions. Two null references are considered to be equal. The

comparison is case sensitive.

 StringUtils.equals(null, null)   = true
StringUtils.equals(null, "abc")  = false
StringUtils.equals("abc", null)  = false
StringUtils.equals("abc", "abc") = true
StringUtils.equals("abc", "ABC") = false

 

Parameters:
str1 - the first String, may be null
str2 - the second String, may be null
Returns:
true if the Strings are equal, case sensitive, or both null
See Also:
String.equals(Object) 
 
startsWith
public static boolean startsWith(String str,
String prefix)
Check if a String starts with a specified prefix.

nulls are handled without exceptions. Two null references are considered to be equal. The

comparison is case sensitive.

 StringUtils.startsWith(null, null)      = true
StringUtils.startsWith(null, "abc")     = false
StringUtils.startsWith("abcdef", null)  = false
StringUtils.startsWith("abcdef", "abc") = true
StringUtils.startsWith("ABCDEF", "abc") = false

 

Parameters:
str - the String to check, may be null
prefix - the prefix to find, may be null
Returns:
true if the String starts with the prefix, case sensitive, or both null
Since:
2.4
See Also:
String.startsWith(String)


1.鍘婚櫎灝鵑儴鎹㈣絎︼紝浣跨敤鍑芥暟錛?/span>StringUtils.chomp(testString)
鍑芥暟浠嬬粛:鍘婚櫎testString灝鵑儴鐨勬崲琛岀
渚嬬▼:
String input = "Hello\n";  
System.out.println( StringUtils.chomp( input ));  
String input2 = "Another test\r\n";  
System.out.println( StringUtils.chomp( input2 )); 

杈撳嚭濡備笅:
    Hello
    Another test


2.鍒ゆ柇瀛楃涓插唴瀹圭殑綾誨瀷錛屽嚱鏁頒粙緇嶏細
StringUtils.isNumeric( testString ) :濡傛灉testString鍏ㄧ敱鏁板瓧緇勬垚榪斿洖True
StringUtils.isAlpha( testString ) :濡傛灉testString鍏ㄧ敱瀛楁瘝緇勬垚榪斿洖True
StringUtils.isAlphanumeric( testString ) :濡傛灉testString鍏ㄧ敱鏁板瓧鎴栨暟瀛楃粍鎴愯繑鍥濼rue
StringUtils.isAlphaspace( testString ) :濡傛灉testString鍏ㄧ敱瀛楁瘝鎴栫┖鏍肩粍鎴愯繑鍥濼rue

渚嬬▼:
String state = "Virginia";  
System.out.println( "Is state number? " + StringUtils.isNumeric(state ) );  
System.out.println( "Is state alpha? " + StringUtils.isAlpha( state ));  
System.out.println( "Is state alphanumeric? " +StringUtils.isAlphanumeric( state ) );  
System.out.println( "Is state alphaspace? " + StringUtils.isAlphaSpace( state ) ); 

杈撳嚭濡備笅:
    Is state number? false
    Is state alpha? true
    Is state alphanumeric? true
    Is state alphaspace? true


3.鏌ユ壘宓屽瀛楃涓詫紝浣跨敤鍑芥暟錛?br /> StringUtils.substringBetween(testString,header,tail)
鍑芥暟浠嬬粛錛氬湪testString涓彇寰梙eader鍜宼ail涔嬮棿鐨勫瓧絎︿覆銆備笉瀛樺湪鍒欒繑鍥炵┖
渚嬬▼錛?br /> String htmlContent = "ABC1234ABC4567";  
System.out.println(StringUtils.substringBetween(htmlContent, "1234", "4567"));  
System.out.println(StringUtils.substringBetween(htmlContent, "12345", "4567")); 

杈撳嚭濡備笅錛?br />     ABC
    null


4.棰犲掑瓧絎︿覆錛屼嬌鐢ㄥ嚱鏁幫細StringUtils.reverse(testString)
鍑芥暟浠嬬粛:寰楀埌testString涓瓧絎﹂鍊掑悗鐨勫瓧絎︿覆
渚嬬▼:
System.out.println( StringUtils.reverse("ABCDE")); 

杈撳嚭濡備笅:
    EDCBA


5.閮ㄥ垎鎴彇瀛楃涓詫紝浣跨敤鍑芥暟錛?/span>
StringUtils.substringBetween(testString,fromString,toString ):鍙栧緱涓ゅ瓧絎︿箣闂寸殑瀛楃涓?br /> StringUtils.substringAfter( ):鍙栧緱鎸囧畾瀛楃涓插悗鐨勫瓧絎︿覆
StringUtils.substringBefore( )錛氬彇寰楁寚瀹氬瓧絎︿覆涔嬪墠鐨勫瓧絎︿覆
StringUtils.substringBeforeLast( )錛氬彇寰楁渶鍚庝竴涓寚瀹氬瓧絎︿覆涔嬪墠鐨勫瓧絎︿覆
StringUtils.substringAfterLast( )錛氬彇寰楁渶鍚庝竴涓寚瀹氬瓧絎︿覆涔嬪悗鐨勫瓧絎︿覆

鍑芥暟浠嬬粛錛氫笂闈㈠簲璇ラ兘璁叉槑鐧戒簡鍚с?br /> 渚嬬▼錛?br /> String formatted = " 25 * (30,40) [50,60] | 30";  
System.out.print("N0: " + StringUtils.substringBeforeLast( formatted, "*" ) );  
System.out.print(", N1: " + StringUtils.substringBetween( formatted, "(", "," ) );  
System.out.print(", N2: " + StringUtils.substringBetween( formatted, ",", ")" ) );  
System.out.print(", N3: " + StringUtils.substringBetween( formatted, "[", "," ) );  
System.out.print(", N4: " + StringUtils.substringBetween( formatted, ",", "]" ) );  
System.out.print(", N5: " + StringUtils.substringAfterLast( formatted, "|" ) ); 

杈撳嚭濡備笅錛?br />     N0: 25 , N1: 30, N2: 40, N3: 50, N4: 40) [50,60, N5: 30



鏂偣 2010-05-30 10:46 鍙戣〃璇勮
]]>
MethodUtilshttp://www.tkk7.com/tfzhu/archive/2010/05/30/322259.html鏂偣鏂偣Sun, 30 May 2010 02:01:00 GMThttp://www.tkk7.com/tfzhu/archive/2010/05/30/322259.htmlhttp://www.tkk7.com/tfzhu/comments/322259.htmlhttp://www.tkk7.com/tfzhu/archive/2010/05/30/322259.html#Feedback0http://www.tkk7.com/tfzhu/comments/commentRss/322259.htmlhttp://www.tkk7.com/tfzhu/services/trackbacks/322259.htmlMethodUtils鐨勭畝鍗曠敤娉曘?/p>
package com.ztf;

import java.util.Map;

import org.apache.commons.beanutils.MethodUtils;
import org.apache.commons.beanutils.PropertyUtils;

public class TestMethodUtils {  
        
public static void main(String[] args) throws Exception{  
              
            Entity entity 
= new Entity();  
            entity.setId(
1) ;
            entity.setName(
"鏂偣");
            
           
// 閫氳繃MethodUtils鐨刬nvokeMethod鏂規硶,鎵ц鎸囧畾鐨別ntity涓殑鏂規硶(鏃犲弬鐨勬儏鍐?
            MethodUtils.invokeMethod(entity, "sayHello"null);  
              
            
// 閫氳繃MethodUtils鐨刬nvokeMethod鏂規硶,鎵ц鎸囧畾鐨別ntity涓殑鏂規硶錛?鍙傜殑鎯呭喌錛?/span>
            MethodUtils.invokeMethod(entity, "sayHello""鏂偣");  
              
            
// 閫氳繃MethodUtils鐨刬nvokeMethod鏂規硶,鎵ц鎸囧畾鐨別ntity涓殑鏂規硶錛堝鍙傜殑鎯呭喌錛?/span>
            Object[] params = new Object[]{new Integer(10),new Integer(12)};  
            MethodUtils.invokeMethod(entity, 
"sayHello", params);  
        }
  
}
  

瀹炰綋錛?br />
package com.ztf;

public class Entity {
    
private Integer id;
    
private String name;
    
    
public void sayHello(){
        System.out.println(
"sayHello()---> 鏃犲弬");
    }

    
    
public void sayHello(String s){
        System.out.println(
"sayHello()---> 鏈?涓弬鏁?/span>" );
    }

    
    
public void sayHello(Integer a,Integer b){
        System.out.println(
"sayHello()---> 鏈?涓弬鏁?/span>");
    }

  
    
public String getName() {
        
return name;
    }

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

    
public Integer getId() {
        
return id;
    }

    
public void setId(Integer id) {
        
this.id = id;
    }

}


杈撳嚭錛?br /> sayHello()---> 鏃犲弬
sayHello()---> 鏈?涓弬鏁?br /> sayHello()---> 鏈?涓弬鏁?br />

鏂偣 2010-05-30 10:01 鍙戣〃璇勮
]]>
PropertyUtilshttp://www.tkk7.com/tfzhu/archive/2010/05/30/322258.html鏂偣鏂偣Sun, 30 May 2010 01:51:00 GMThttp://www.tkk7.com/tfzhu/archive/2010/05/30/322258.htmlhttp://www.tkk7.com/tfzhu/comments/322258.htmlhttp://www.tkk7.com/tfzhu/archive/2010/05/30/322258.html#Feedback0http://www.tkk7.com/tfzhu/comments/commentRss/322258.htmlhttp://www.tkk7.com/tfzhu/services/trackbacks/322258.html
package com.ztf;

public class Entity {
    
private Integer id;
    
private String name;
    
    
public void sayHello(){
        System.out.println(
"sayHello()---> 鏃犲弬");
    }

    
    
public void sayHello(String s){
        System.out.println(
"sayHello()---> 鏈?涓弬鏁?/span>" );
    }

    
    
public void sayHello(Integer a,Integer b){
        System.out.println(
"sayHello()---> 鏈?涓弬鏁?/span>");
    }

  
    
public String getName() {
        
return name;
    }

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

    
public Integer getId() {
        
return id;
    }

    
public void setId(Integer id) {
        
this.id = id;
    }

}


package com.ztf;
import java.util.Map;

import org.apache.commons.beanutils.MethodUtils;
import org.apache.commons.beanutils.PropertyUtils;

public class TestPropertyUtils {  
        
public static void main(String[] args) throws Exception{  
              
            Entity entity 
= new Entity();  
            entity.setId(
1) ;
            entity.setName(
"鏂偣");
            
            
// 閫氳繃PropertyUtils鐨刧etProperty鏂規硶鑾峰彇鎸囧畾灞炴х殑鍊?/span>
            Integer id = (Integer)PropertyUtils.getProperty(entity, "id");  
            String name 
= (String)PropertyUtils.getProperty(entity, "name");  
            System.out.println(
"id = " + id + "  name = " + name);  
              
            
// 璋冪敤PropertyUtils鐨剆etProperty鏂規硶璁劇疆entity鐨勬寚瀹氬睘鎬?/span>
            PropertyUtils.setProperty(entity, "name""姣忓ぉ榪涙涓鐐?/span>");  
            System.out.println(
"name = " + entity.getName());  
              
            
// 閫氳繃PropertyUtils鐨刣escribe鏂規硶鎶奺ntity鐨勬墍鏈夊睘鎬т笌灞炴у煎皝瑁呰繘Map涓?/span>
            Map map = PropertyUtils.describe(entity);  
            System.out.println(
"id = " + map.get("id"+ "  name = " + map.get("name"));  
              
                  }
  
}
  

杈撳嚭錛?br /> id = 1  name = 鏂偣
name = 姣忓ぉ榪涙涓鐐?br /> id = 1  name = 姣忓ぉ榪涙涓鐐?br />

鍏跺畠渚嬪瓙錛?br /> import org.apache.commons.beanutils.PropertyUtils;
List<Map<String, Object>> data = new ArrayList<Map<String, Object>>();
for(BaseGrpMemberVO member : MemberVO){
          Map m = new HashMap();
          for(Map.Entry<String, String> entry: fieldMap.entrySet()){
                    String key = entry.getKey();
                    fieldList.add(key); //璁板綍瀛楁鍚?br />                     String[] keyArray = key.split("\\.");
                    if(keyArray.length == 2){//鎴愬憳淇℃伅
                        Object o =PropertyUtils.getProperty(member, keyArray[1]);
                        m.put(key, o==null?"":o.toString());
                    }else if(keyArray.length == 3){//闄╁埆淇℃伅
                        List<BaseGrpCvrgVO> cvrgVoList = mgr.getRelCvrgById(member.getCPkId());
                        String cvrgNo = keyArray[0];
                        for(BaseGrpCvrgVO cvrgVo : cvrgVoList){
                            if(cvrgNo.equals(cvrgVo.getCCvrgNo())){
                                Object o =PropertyUtils.getProperty(cvrgVo, keyArray[2]);
                                m.put(key, o==null?"":o.toString());
                            }
                        }   
                    }
                }
          data.add(m);
       }


鏂偣 2010-05-30 09:51 鍙戣〃璇勮
]]>
BeanUtilshttp://www.tkk7.com/tfzhu/archive/2010/05/30/322256.html鏂偣鏂偣Sun, 30 May 2010 01:25:00 GMThttp://www.tkk7.com/tfzhu/archive/2010/05/30/322256.htmlhttp://www.tkk7.com/tfzhu/comments/322256.htmlhttp://www.tkk7.com/tfzhu/archive/2010/05/30/322256.html#Feedback0http://www.tkk7.com/tfzhu/comments/commentRss/322256.htmlhttp://www.tkk7.com/tfzhu/services/trackbacks/322256.htmlapache.commons.beanutils.BeanUtils
璇lass鎻愪緵浜嗕竴緋誨垪鐨勯潤鎬佹柟娉曟搷浣滃凡瀛樺湪鐨勭鍚圝avaBean瑙勮寖瀹氫箟鐨凧ava Class.榪欓噷寮鴻皟鐨凧avaBean瑙勮寖,綆鍗曟潵璇村氨鏄竴涓狫ava Class閫氳繃涓緋誨垪getter鍜宻etter鐨勬柟娉曞悜澶栫晫灞曠ず鍏跺唴鍦ㄧ殑鎴愬憳鍙橀噺(灞炴?銆?br />
閫氳繃BeanUtils鐨勯潤鎬佹柟娉?鎴戜滑鍙互:
澶嶅埗涓涓狫avaBean鐨勫疄渚?-BeanUtils.cloneBean();
鍦ㄤ竴涓狫avaBean鐨勪袱涓疄渚嬩箣闂村鍒跺睘鎬?-BeanUtils.copyProperties(),BeanUtils.copyProperty();
涓轟竴涓狫avaBean鐨勫疄渚嬭緗垚鍛樺彉閲?灞炴?鍊?-BeanUtils.populate(),BeanUtils.setProperty();
浠庝竴涓狫avaBean鐨勫疄渚嬩腑璇誨彇鎴愬憳鍙橀噺(灞炴?鐨勫?-BeanUtils.getArrayProperty(),BeanUtils.getIndexedProperty(),BeanUtils.getMappedProperty(),BeanUtils.getNestedProperty(),BeanUtils.getSimpleProperty(),BeanUtils.getProperty(),BeanUtils.describe();

1銆丅eanUtils.cloneBean(java.lang.object bean)
涓篵ean鍒涘緩涓涓猚lone瀵硅薄,鏂規硶榪斿洖綾誨瀷涓篛bject.姝ゆ柟娉曠殑瀹炵幇鏈哄埗寤虹珛鍦╞ean鎻愪緵鐨勪竴緋誨垪鐨刧etters鍜宻etters鐨勫熀紜涔嬩笂.姝ゆ柟娉曠殑姝e父浣跨敤浠g爜闈炲父綆鍗?鏁呯暐鎺?

 

2銆丅eanUtils.copyProperties(java.lang.Object dest, java.lang.Object orig)
涓涓猙ean class鏈変袱涓疄渚?orig鍜宒est,灝唎rig涓殑鎴愬憳鍙橀噺鐨勫煎鍒剁粰dest,鍗沖皢宸茬粡瀛樺湪鐨刣est鍙樹負orig鐨勫壇鏈?涓嶣eanUtils.cloneBean(java.lang.object bean)鐨勫尯鍒氨鍦ㄤ簬鏄笉鏄渶瑕佸垱寤烘柊鐨勫疄渚嬩簡.
鍘熸枃濡備笅:Copy property values from the origin bean to the destination bean for all cases where the property names are the same.


3銆丅eanUtils.setProperty(java.lang.Object bean,java.lang.String name,java.lang.Object value)
榪欎釜鏂規硶綆鍗曠殑璇村氨鏄皢bean涓殑鎴愬憳鍙橀噺name璧嬪間負value.


BeanUtils.populate(java.lang.Object bean, java.util.Map properties)
浣跨敤涓涓猰ap涓篵ean璧嬪?璇ap涓殑key鐨勫悕縐頒笌bean涓殑鎴愬憳鍙橀噺鍚嶇О鐩稿搴?娉ㄦ剰:鍙湁鍦╧ey鍜屾垚鍛樺彉閲忓悕縐板畬鍏ㄥ搴旂殑鏃跺?populate鏈哄埗鎵嶅彂鐢熶綔鐢?浣嗘槸鍦ㄦ暟閲忎笂娌℃湁浠諱綍瑕佹眰,濡俶ap涓殑key濡傛灉鏄垚鍛樺彉閲忓悕縐扮殑瀛愰泦,閭d箞鎴愬憳鍙橀噺涓湁鐨勮宮ap涓笉鍖呭惈鐨勯」灝嗕細淇濈暀榛樿鍊?鍚屾牱,濡傛灉鎴愬憳鍙橀噺鏄痬ap涓璳ey鐨勫瓙闆?閭d箞澶氫綑鐨刱ey涓嶄細瀵筽opulate鐨勭粨鏋滀駭鐢熶換浣曞獎鍝?鎭?緇撴灉灝辨槸populate鍙拡瀵筸ap涓璳ey鍚嶇О闆嗗悎涓巄ean涓垚鍛樺彉閲忓悕縐伴泦鍚堢殑浜ら泦浜х敓浣滅敤銆?/span>


4銆丅eanUtils.getArrayProperty(java.lang.Object bean,java.lang.String name)
鑾峰彇bean涓暟緇勬垚鍛樺彉閲?灞炴?鐨勫?
濡傛灉鎴戜滑鎸囧畾鐨刵ame涓嶆槸鏁扮粍綾誨瀷鐨勬垚鍛樺彉閲?緇撴灉浼氬浣?浼氫笉浼氭姏鍑虹被鍨嬮敊璇殑exception鍛?鍥炵瓟鏄笉浼?浠嶇劧浼氳繑鍥炰竴涓猄tring鐨勬暟緇?鏁扮粍鐨勭涓欏瑰氨鏄痭ame瀵瑰簲鐨勫?濡傛灉涓?/p>

鏄疭tring綾誨瀷鐨勮瘽,JVM浼氳嚜鍔ㄧ殑璋冪敤toString()鏂規硶鐨?.


BeanUtils.getIndexedProperty(java.lang.Object bean,java.lang.String name)
BeanUtils.getIndexedProperty(java.lang.Object bean,java.lang.String name,int index)
榪欎袱涓柟娉曢兘鏄幏鍙栨暟緇勬垚鍛樺彉閲?灞炴?涓殑鍗曚竴鍏冪礌鍊肩殑鏂規硶.
姣斿,鎴戞兂寰楀埌SampleObject涓瓀ords[1]鐨勫?鐢ㄦ硶濡備笅:
BeanUtils.getIndexedProperty(sampleOjbectInstance,"words[1]");
BeanUtils.getIndexedProperty(sampleOjbectInstance,"words",1);


BeanUtils.getMappedProperty(java.lang.Object bean,java.lang.String name)
BeanUtils.getMappedProperty(java.lang.Object bean,java.lang.String name,java.lang.String key)


BeanUtils.describe(java.lang.Object bean)
灝嗕竴涓猙ean浠ap鐨勫艦寮忓睍紺恒?br />

鏉ユ簮錛歨ttp://www.chinaitpower.com/A/2005-07-03/150232.html

鏂偣 2010-05-30 09:25 鍙戣〃璇勮
]]>
ArrayUtils 鐨勪嬌鐢?/title><link>http://www.tkk7.com/tfzhu/archive/2010/05/17/321218.html</link><dc:creator>鏂偣</dc:creator><author>鏂偣</author><pubDate>Mon, 17 May 2010 15:57:00 GMT</pubDate><guid>http://www.tkk7.com/tfzhu/archive/2010/05/17/321218.html</guid><wfw:comment>http://www.tkk7.com/tfzhu/comments/321218.html</wfw:comment><comments>http://www.tkk7.com/tfzhu/archive/2010/05/17/321218.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/tfzhu/comments/commentRss/321218.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/tfzhu/services/trackbacks/321218.html</trackback:ping><description><![CDATA[<font face="Courier New" size="2">ArrayUtils綾誨府鎴戜滑瀹屾垚鏁扮粍鐨勬墦鍗般佹煡鎵俱佸厠闅嗐佸掑簭銆佷互鍙婂煎瀷/瀵硅薄鏁扮粍涔嬮棿鐨勮漿鎹㈢瓑鎿嶄綔銆?br /> <br /> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 10pt; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><span style="color: #008080"> 1</span><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><span style="color: #0000ff">import</span><span style="color: #000000"> org.apache.commons.lang.ArrayUtils;<br /> </span><span style="color: #008080"> 2</span><span style="color: #000000"><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /> </span><span style="color: #008080"> 3</span><span style="color: #000000"><img id="Codehighlighter1_72_491_Open_Image" onclick="this.style.display='none'; Codehighlighter1_72_491_Open_Text.style.display='none'; Codehighlighter1_72_491_Closed_Image.style.display='inline'; Codehighlighter1_72_491_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_72_491_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_72_491_Closed_Text.style.display='none'; Codehighlighter1_72_491_Open_Image.style.display='inline'; Codehighlighter1_72_491_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" alt="" /></span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> TestArrayUtils </span><span id="Codehighlighter1_72_491_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_72_491_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080"> 4</span><span style="color: #000000"><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />    <br /> </span><span style="color: #008080"> 5</span><span style="color: #000000"><img id="Codehighlighter1_122_489_Open_Image" onclick="this.style.display='none'; Codehighlighter1_122_489_Open_Text.style.display='none'; Codehighlighter1_122_489_Closed_Image.style.display='inline'; Codehighlighter1_122_489_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_122_489_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_122_489_Closed_Text.style.display='none'; Codehighlighter1_122_489_Open_Image.style.display='inline'; Codehighlighter1_122_489_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />    </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) </span><span id="Codehighlighter1_122_489_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_122_489_Open_Text"><span style="color: #000000">{   <br /> </span><span style="color: #008080"> 6</span><span style="color: #000000"><img id="Codehighlighter1_135_169_Open_Image" onclick="this.style.display='none'; Codehighlighter1_135_169_Open_Text.style.display='none'; Codehighlighter1_135_169_Closed_Image.style.display='inline'; Codehighlighter1_135_169_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_135_169_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_135_169_Closed_Text.style.display='none'; Codehighlighter1_135_169_Open_Image.style.display='inline'; Codehighlighter1_135_169_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />        </span><span id="Codehighlighter1_135_169_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/** */</span><span id="Codehighlighter1_135_169_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /> </span><span style="color: #008080"> 7</span><span style="color: #008000"><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />         * 鎵撳嵃鏁扮粍涓殑鍐呭<br /> </span><span style="color: #008080"> 8</span><span style="color: #008000"><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />         </span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /> </span><span style="color: #008080"> 9</span><span style="color: #000000"><img id="Codehighlighter1_206_222_Open_Image" onclick="this.style.display='none'; Codehighlighter1_206_222_Open_Text.style.display='none'; Codehighlighter1_206_222_Closed_Image.style.display='inline'; Codehighlighter1_206_222_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_206_222_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_206_222_Closed_Text.style.display='none'; Codehighlighter1_206_222_Open_Image.style.display='inline'; Codehighlighter1_206_222_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />        </span><span style="color: #0000ff">int</span><span style="color: #000000">[] intArray </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> </span><span style="color: #0000ff">int</span><span style="color: #000000">[] </span><span id="Codehighlighter1_206_222_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_206_222_Open_Text"><span style="color: #000000">{ </span><span style="color: #000000">2</span><span style="color: #000000">, </span><span style="color: #000000">3</span><span style="color: #000000">, </span><span style="color: #000000">4</span><span style="color: #000000">, </span><span style="color: #000000">5</span><span style="color: #000000">, </span><span style="color: #000000">6</span><span style="color: #000000"> }</span></span><span style="color: #000000">;<br /> </span><span style="color: #008080">10</span><span style="color: #000000"><img id="Codehighlighter1_270_305_Open_Image" onclick="this.style.display='none'; Codehighlighter1_270_305_Open_Text.style.display='none'; Codehighlighter1_270_305_Closed_Image.style.display='inline'; Codehighlighter1_270_305_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_270_305_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_270_305_Closed_Text.style.display='none'; Codehighlighter1_270_305_Open_Image.style.display='inline'; Codehighlighter1_270_305_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />        </span><span style="color: #0000ff">int</span><span style="color: #000000">[][] multiDimension </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> </span><span style="color: #0000ff">int</span><span style="color: #000000">[][] </span><span id="Codehighlighter1_270_305_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_270_305_Open_Text"><span style="color: #000000">{ </span><span id="Codehighlighter1_272_282_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_272_282_Open_Text"><span style="color: #000000">{ </span><span style="color: #000000">1</span><span style="color: #000000">, </span><span style="color: #000000">2</span><span style="color: #000000">, </span><span style="color: #000000">3</span><span style="color: #000000"> }</span></span><span style="color: #000000">, </span><span id="Codehighlighter1_285_292_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_285_292_Open_Text"><span style="color: #000000">{ </span><span style="color: #000000">2</span><span style="color: #000000">, </span><span style="color: #000000">3</span><span style="color: #000000"> }</span></span><span style="color: #000000">, </span><span id="Codehighlighter1_295_303_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_295_303_Open_Text"><span style="color: #000000">{</span><span style="color: #000000">5</span><span style="color: #000000">, </span><span style="color: #000000">6</span><span style="color: #000000">, </span><span style="color: #000000">7</span><span style="color: #000000">}</span></span><span style="color: #000000"> }</span></span><span style="color: #000000">;<br /> </span><span style="color: #008080">11</span><span style="color: #000000"><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        <br /> </span><span style="color: #008080">12</span><span style="color: #000000"><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        System.out.println( </span><span style="color: #000000">"</span><span style="color: #000000">intArray: </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> ArrayUtils.toString( intArray ) );<br /> </span><span style="color: #008080">13</span><span style="color: #000000"><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        System.out.println( </span><span style="color: #000000">"</span><span style="color: #000000">multiDimension: </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> ArrayUtils.toString( multiDimension ) );<br /> </span><span style="color: #008080">14</span><span style="color: #000000"><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />    }</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">15</span><span style="color: #000000"><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" alt="" />}</span></span></div> <br /> 杈撳嚭錛?br /> intArray: {2,3,4,5,6}<br /> multiDimension: {{1,2,3},{2,3},{5,6,7}}<br /> </font> <img src ="http://www.tkk7.com/tfzhu/aggbug/321218.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/tfzhu/" target="_blank">鏂偣</a> 2010-05-17 23:57 <a href="http://www.tkk7.com/tfzhu/archive/2010/05/17/321218.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>CollectionUtils 鐨勪嬌鐢?/title><link>http://www.tkk7.com/tfzhu/archive/2010/05/17/321212.html</link><dc:creator>鏂偣</dc:creator><author>鏂偣</author><pubDate>Mon, 17 May 2010 15:29:00 GMT</pubDate><guid>http://www.tkk7.com/tfzhu/archive/2010/05/17/321212.html</guid><wfw:comment>http://www.tkk7.com/tfzhu/comments/321212.html</wfw:comment><comments>http://www.tkk7.com/tfzhu/archive/2010/05/17/321212.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/tfzhu/comments/commentRss/321212.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/tfzhu/services/trackbacks/321212.html</trackback:ping><description><![CDATA[ <span id="caewuqu" class="hilite1">CollectionUtils</span> 涓洓涓柟娉曞闆嗗悎鎿嶄綔錛?union()錛宨ntersection()錛宒isjunction();錛宻ubtract()銆?br /> <br /> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 10pt; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><span style="color: #008080"> 1</span><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #0000ff">import</span><span style="color: #000000"> java.util.Arrays;     <br /> </span><span style="color: #008080"> 2</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.util.Collection;     <br /> </span><span style="color: #008080"> 3</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.util.Collections;     <br /> </span><span style="color: #008080"> 4</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.util.List;     <br /> </span><span style="color: #008080"> 5</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />     <br /> </span><span style="color: #008080"> 6</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> org.apache.commons.collections.CollectionUtils;     <br /> </span><span style="color: #008080"> 7</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> org.apache.commons.lang.ArrayUtils;     <br /> </span><span style="color: #008080"> 8</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />     <br /> </span><span style="color: #008080"> 9</span><span style="color: #000000"><img id="Codehighlighter1_280_1737_Open_Image" onclick="this.style.display='none'; Codehighlighter1_280_1737_Open_Text.style.display='none'; Codehighlighter1_280_1737_Closed_Image.style.display='inline'; Codehighlighter1_280_1737_Closed_Text.style.display='inline';" alt="" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_280_1737_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_280_1737_Closed_Text.style.display='none'; Codehighlighter1_280_1737_Open_Image.style.display='inline'; Codehighlighter1_280_1737_Open_Text.style.display='inline';" alt="" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> TestCollectionUtils </span><span id="Codehighlighter1_280_1737_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_280_1737_Open_Text"><span style="color: #000000">{     <br /> </span><span style="color: #008080">10</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /> @SuppressWarnings(</span><span style="color: #000000">"</span><span style="color: #000000">unchecked</span><span style="color: #000000">"</span><span style="color: #000000">)     <br /> </span><span style="color: #008080">11</span><span style="color: #000000"><img id="Codehighlighter1_364_1730_Open_Image" onclick="this.style.display='none'; Codehighlighter1_364_1730_Open_Text.style.display='none'; Codehighlighter1_364_1730_Closed_Image.style.display='inline'; Codehighlighter1_364_1730_Closed_Text.style.display='inline';" alt="" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_364_1730_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_364_1730_Closed_Text.style.display='none'; Codehighlighter1_364_1730_Open_Image.style.display='inline'; Codehighlighter1_364_1730_Open_Text.style.display='inline';" alt="" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </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) </span><span id="Codehighlighter1_364_1730_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_364_1730_Open_Text"><span style="color: #000000">{     <br /> </span><span style="color: #008080">12</span><span style="color: #000000"><img id="Codehighlighter1_404_435_Open_Image" onclick="this.style.display='none'; Codehighlighter1_404_435_Open_Text.style.display='none'; Codehighlighter1_404_435_Closed_Image.style.display='inline'; Codehighlighter1_404_435_Closed_Text.style.display='inline';" alt="" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_404_435_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_404_435_Closed_Text.style.display='none'; Codehighlighter1_404_435_Open_Image.style.display='inline'; Codehighlighter1_404_435_Open_Text.style.display='inline';" alt="" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  String[] arrayA </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> String[] </span><span id="Codehighlighter1_404_435_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_404_435_Open_Text"><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">, </span><span style="color: #000000">"</span><span style="color: #000000">2</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">, </span><span style="color: #000000">"</span><span style="color: #000000">3</span><span style="color: #000000">"</span><span style="color: #000000">, </span><span style="color: #000000">"</span><span style="color: #000000">4</span><span style="color: #000000">"</span><span style="color: #000000">, </span><span style="color: #000000">"</span><span style="color: #000000">5</span><span style="color: #000000">"</span><span style="color: #000000"> }</span></span><span style="color: #000000">;     <br /> </span><span style="color: #008080">13</span><span style="color: #000000"><img id="Codehighlighter1_476_507_Open_Image" onclick="this.style.display='none'; Codehighlighter1_476_507_Open_Text.style.display='none'; Codehighlighter1_476_507_Closed_Image.style.display='inline'; Codehighlighter1_476_507_Closed_Text.style.display='inline';" alt="" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_476_507_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_476_507_Closed_Text.style.display='none'; Codehighlighter1_476_507_Open_Image.style.display='inline'; Codehighlighter1_476_507_Open_Text.style.display='inline';" alt="" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  String[] arrayB </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> String[] </span><span id="Codehighlighter1_476_507_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_476_507_Open_Text"><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">, </span><span style="color: #000000">"</span><span style="color: #000000">4</span><span style="color: #000000">"</span><span style="color: #000000">, </span><span style="color: #000000">"</span><span style="color: #000000">4</span><span style="color: #000000">"</span><span style="color: #000000">, </span><span style="color: #000000">"</span><span style="color: #000000">5</span><span style="color: #000000">"</span><span style="color: #000000">, </span><span style="color: #000000">"</span><span style="color: #000000">6</span><span style="color: #000000">"</span><span style="color: #000000">, </span><span style="color: #000000">"</span><span style="color: #000000">7</span><span style="color: #000000">"</span><span style="color: #000000"> }</span></span><span style="color: #000000">;     <br /> </span><span style="color: #008080">14</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />     <br /> </span><span style="color: #008080">15</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  List</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000"> a </span><span style="color: #000000">=</span><span style="color: #000000"> Arrays.asList(arrayA);     <br /> </span><span style="color: #008080">16</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  List</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000"> b </span><span style="color: #000000">=</span><span style="color: #000000"> Arrays.asList(arrayB);     <br /> </span><span style="color: #008080">17</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="color: #008000">//</span><span style="color: #008000"> 騫墮泦</span><span style="color: #008000"><br /> </span><span style="color: #008080">18</span><span style="color: #008000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">  Collection</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000"> union </span><span style="color: #000000">=</span><span style="color: #000000"> CollectionUtils.union(a, b);     <br /> </span><span style="color: #008080">19</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="color: #008000">//</span><span style="color: #008000"> 浜ら泦</span><span style="color: #008000"><br /> </span><span style="color: #008080">20</span><span style="color: #008000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">  Collection</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000"> intersection </span><span style="color: #000000">=</span><span style="color: #000000"> CollectionUtils.intersection(a, b);     <br /> </span><span style="color: #008080">21</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="color: #008000">//</span><span style="color: #008000"> 浜ら泦鐨勮ˉ闆?/span><span style="color: #008000"><br /> </span><span style="color: #008080">22</span><span style="color: #008000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">  Collection</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000"> disjunction </span><span style="color: #000000">=</span><span style="color: #000000"> CollectionUtils.disjunction(a, b);     <br /> </span><span style="color: #008080">23</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="color: #008000">//</span><span style="color: #008000"> 闆嗗悎鐩稿噺</span><span style="color: #008000"><br /> </span><span style="color: #008080">24</span><span style="color: #008000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">  Collection</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000"> subtract </span><span style="color: #000000">=</span><span style="color: #000000"> CollectionUtils.subtract(a, b);     <br /> </span><span style="color: #008080">25</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />     <br /> </span><span style="color: #008080">26</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  Collections.sort((List</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000">) union);     <br /> </span><span style="color: #008080">27</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  Collections.sort((List</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000">) intersection);     <br /> </span><span style="color: #008080">28</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  Collections.sort((List</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000">) disjunction);     <br /> </span><span style="color: #008080">29</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  Collections.sort((List</span><span style="color: #000000"><</span><span style="color: #000000">String</span><span style="color: #000000">></span><span style="color: #000000">) subtract);     <br /> </span><span style="color: #008080">30</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />     <br /> </span><span style="color: #008080">31</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  System.out.println(</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"> ArrayUtils.toString(a.toArray()));     <br /> </span><span style="color: #008080">32</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  System.out.println(</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"> ArrayUtils.toString(b.toArray()));     <br /> </span><span style="color: #008080">33</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">--------------------------------------------</span><span style="color: #000000">"</span><span style="color: #000000">);     <br /> </span><span style="color: #008080">34</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">Union(A, B): </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> ArrayUtils.toString(union.toArray()));     <br /> </span><span style="color: #008080">35</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">Intersection(A, B): </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> ArrayUtils.toString(intersection.toArray()));     <br /> </span><span style="color: #008080">36</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">Disjunction(A, B): </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> ArrayUtils.toString(disjunction.toArray()));     <br /> </span><span style="color: #008080">37</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />  System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">Subtract(A, B): </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> ArrayUtils.toString(subtract.toArray()));     <br /> </span><span style="color: #008080">38</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /> }</span></span><span style="color: #000000">     <br /> </span><span style="color: #008080">39</span><span style="color: #000000"><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: #000000">   </span></div> <br /> 杈撳嚭錛?br /> A: {1,2,3,3,4,5}<br /> B: {3,4,4,5,6,7}<br /> --------------------------------------------<br /> Union(A, B): {1,2,3,3,4,4,5,6,7}<br /> Intersection(A, B): {3,4,5}<br /> Disjunction(A, B): {1,2,3,4,6,7}<br /> Subtract(A, B): {1,2,3}<br /> <br /> 杞澆錛歨ttp://blog.csdn.net/ofofw/archive/2009/06/26/4300964.aspx <img src ="http://www.tkk7.com/tfzhu/aggbug/321212.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/tfzhu/" target="_blank">鏂偣</a> 2010-05-17 23:29 <a href="http://www.tkk7.com/tfzhu/archive/2010/05/17/321212.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://taojin5.com" target="_blank">你懂的网址免费国产</a>| <a href="http://w6626.com" target="_blank">免费观看成人久久网免费观看</a>| <a href="http://doubaye.com" target="_blank">亚洲av高清在线观看一区二区 </a>| <a href="http://wxzg66.com" target="_blank">中文字幕日本人妻久久久免费</a>| <a href="http://cqkalai.com" target="_blank">亚洲人成网77777色在线播放</a>| <a href="http://yuejiju.com" target="_blank">69视频在线观看高清免费</a>| <a href="http://wwwav800.com" target="_blank">亚洲国产精品无码观看久久</a>| <a href="http://lyaa17.com" target="_blank">国产偷窥女洗浴在线观看亚洲</a>| <a href="http://234an.com" target="_blank">亚洲无砖砖区免费</a>| <a href="http://hubmba.com" target="_blank">精品亚洲国产成人av</a>| <a href="http://mt569.com" target="_blank">图图资源网亚洲综合网站</a>| <a href="http://jinmenonline.com" target="_blank">天天摸夜夜摸成人免费视频</a>| <a href="http://ge2hao.com" target="_blank">中文字幕免费在线视频</a>| <a href="http://18yinren.com" target="_blank">亚洲AV无码成人专区</a>| <a href="http://yuezhaoming.com" target="_blank">国产成人精品日本亚洲专区</a>| <a href="http://xhm33.com" target="_blank">成年私人影院免费视频网站</a>| <a href="http://9898vip.com" target="_blank">免费一区二区无码东京热</a>| <a href="http://43sihu.com" target="_blank">亚洲丁香婷婷综合久久</a>| <a href="http://cebeke.com" target="_blank">久久久久亚洲AV无码麻豆</a>| <a href="http://jastrelax.com" target="_blank">免费国产真实迷j在线观看</a>| <a href="http://555yyyy.com" target="_blank">亚洲成年人免费网站</a>| <a href="http://ymtphoto.com" target="_blank">高清永久免费观看</a>| <a href="http://https357171.com" target="_blank">亚洲精品无码久久久久牙蜜区</a>| <a href="http://68996500.com" target="_blank">亚洲成色999久久网站</a>| <a href="http://trgod.com" target="_blank">亚洲AV无码一区二区三区国产</a>| <a href="http://kj555888.com" target="_blank">99久久99这里只有免费费精品</a>| <a href="http://ynxxrh.com" target="_blank">九九热久久免费视频</a>| <a href="http://hhrrrr.com" target="_blank">色九月亚洲综合网</a>| <a href="http://yy885.com" target="_blank">久久精品亚洲AV久久久无码</a>| <a href="http://502274.com" target="_blank">久久精品国产精品亚洲精品</a>| <a href="http://joob4s.com" target="_blank">免费**毛片在线播放直播</a>| <a href="http://dxjz120.com" target="_blank">成人性生交大片免费看无遮挡</a>| <a href="http://828556.com" target="_blank">亚欧免费一级毛片</a>| <a href="http://yiren2233.com" target="_blank">全部在线播放免费毛片</a>| <a href="http://haoda8.com" target="_blank">亚洲中文字幕久久精品蜜桃</a>| <a href="http://7s8s.com" target="_blank">亚洲精品美女在线观看</a>| <a href="http://jinluffcl.com" target="_blank">亚洲欧洲美洲无码精品VA</a>| <a href="http://doctor5470.com" target="_blank">亚洲A∨午夜成人片精品网站 </a>| <a href="http://znboxcdn304.com" target="_blank">亚洲中文字幕无码专区</a>| <a href="http://xxxxcccc.com" target="_blank">免费看无码自慰一区二区</a>| <a href="http://8833655.com" target="_blank">曰批视频免费30分钟成人</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>