久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      java判斷是否空的方法

      java判斷是否空的方法

      java判斷是否空的方法:

      1、判斷字符串或者對象是否為空

      StringUtils的判斷

      StringUtils.isEmpty(CharSequence cs); //org.apache.commons.lang3包下的StringUtils類,判斷是否為空的方法參數(shù)是字符序列類,也就是String類型

      StringUtils.isEmpty(Object str); //而org.springframework.util包下的參數(shù)是Object類,也就是不僅僅能判斷String類型,還能判斷其他類型,比如Long等類型。

      org.apache.commons.lang3的StringUtils.isEmpty(CharSequence cs)源碼:

      public static boolean isEmpty(final CharSequence cs) {         return cs == null || cs.length() == 0; }

      org.springframework.util的StringUtils.isEmpty(Object str)源碼:

      public static boolean isEmpty(Object str) {         return (str == null || "".equals(str)); }

      基本上判斷對象是否為空,StringUtils.isEmpty(Object str)這個方法都能搞定。

      2、判斷數(shù)組是否為空

      list.isEmpty(); //返回boolean類型。

      3、判斷集合是否為空

      CollectionUtils.isEmpty(null): true CollectionUtils.isEmpty(new ArrayList()): true CollectionUtils.isEmpty({a,b}): false

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號