zoukankan      html  css  js  c++  java
  • 集合

    package com.javacollection.www;

    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Iterator;

    public class cullectionDmeo{

     private static String space=" ";

     public static void main(String[] args) {
      //我有个字符串数组
      String str="I am man";
      //分解为多个字符串
      String[] str1=str.split(space);
      StringBuffer sb=new StringBuffer();
      
      /*sb.append("[");
      for(int i=0;i<str1.length;i++){
       if(i<str1.length-1){
        sb.append(str1[i]);
       }else{
        sb.append(str1[i]+"]");
       }
       //System.out.println(str1[i]);
      }
      //System.out.println(sb);
      */
      Collection cul=new ArrayList();
      Collection cu2=new ArrayList();
      /**
       * 把str1中的字符串组添加进去
       */
      cul.add(str1[0]);
      System.out.println(cul);
      //把str1中的全部元素添加进去
      //cul.add(sb);
      //System.out.println(cul);
      for (int i = 0; i < str1.length; i++) {
       //System.out.print(str1[i]+" ");
      }
      cu2.addAll(cul);
      System.out.println(cu2);
      cu2.removeAll(cul);
      System.out.println(cu2);
      
     }
    }

  • 相关阅读:
    DeflateStream类
    BufferedStream类
    FileStream类
    Asp.net MVC Comet 推送
    MVC 读书笔记
    MVC部署
    MVC系统过滤器、自定义过滤器
    MVC 路由规则
    MVC 模型绑定
    边双+点双模板
  • 原文地址:https://www.cnblogs.com/daoxiang1992/p/5723735.html
Copyright © 2011-2022 走看看