Package java.util

Examples of java.util.ArrayList$ArrayListSpliterator


  {

    BindSelectHandler handler = new BindSelectHandler();
    handler.setBeanPropertyIdName("id");

    Collection collection = new ArrayList();
    collection.add(new DomainClass(1));
    collection.add(new DomainClass(3));
    collection.add(new DomainClass(4));
    Map map = handler.getPropertyAsMap(collection);

    assert map.size() == 3;
    assert map instanceof HashMap;
View Full Code Here


      String[] emails = StringUtils.split(s_mails, ";",MAX_MAIL_COUNT);
      if(emails==null || emails.length==0){
        msgs.add("photo", new ActionMessage("error.no_share_mails"));
        break;
      }
      List vtMails = new ArrayList();
      for(int i=0;i<emails.length;i++){
        String sm = emails[i].trim();
        if(StringUtils.isEmail(sm) && !vtMails.contains(sm))
          vtMails.add(sm);
      }
      if(vtMails.size()==0){
        msgs.add("photo", new ActionMessage("error.no_valid_mail"));
        break;
      }
      sendMails(request, loginUser, pbean, vtMails);
      msgs.add("share", new ActionMessage("mail.sent"));
View Full Code Here

/**
* Constructor.
*/
public SwingLE() {
    super();
    pageContents = new ArrayList();
    ErrorHandler.useGUI(true);
}
View Full Code Here

    assertEquals("hello\n<br />world",
     StringUtils.newlinesToXHTMLBreaks("hello\r\nworld"));
}

public void testSplit() {
    ArrayList typicalAnswer = new ArrayList();
    typicalAnswer.add("a");
    typicalAnswer.add("b");
    typicalAnswer.add("c");

    ArrayList origStringAnswer = new ArrayList();
    origStringAnswer.add("abc");

    // Special cases
    assertNull(StringUtils.split(null, null));
    assertEquals(origStringAnswer, StringUtils.split("abc", null));
    assertEquals(origStringAnswer, StringUtils.split("abc", "x"));

    assertEquals(typicalAnswer, StringUtils.split("a.b.c", "."));
    assertEquals(typicalAnswer, StringUtils.split("a**&*b**&*c", "**&*"));

    ArrayList answer = new ArrayList(typicalAnswer);
    answer.add(0, "");
    assertEquals(answer, StringUtils.split(".a.b.c", "."));
    assertEquals(answer, StringUtils.split("**&*a**&*b**&*c", "**&*"));

    answer = new ArrayList(typicalAnswer);
    answer.add(1, "");
    assertEquals(answer, StringUtils.split("a..b.c", "."));
    assertEquals(answer, StringUtils.split("a**&***&*b**&*c", "**&*"));

    answer = new ArrayList(typicalAnswer);
    answer.add("");
    assertEquals(answer, StringUtils.split("a.b.c.", "."));
    assertEquals(answer, StringUtils.split("a**&*b**&*c**&*", "**&*"));

    answer = new ArrayList(typicalAnswer);
    answer.add(1, "");
    answer.add("");
    assertEquals(answer, StringUtils.split("a..b.c.", "."));
    assertEquals(answer, StringUtils.split("a**&***&*b**&*c**&*", "**&*"));
}
 
View Full Code Here

public void testJoin() {
    assertEquals("", StringUtils.join(null, null));
    assertEquals("", StringUtils.join(null, ","));

    ArrayList list = new ArrayList();
    assertEquals("", StringUtils.join(list, null));
    assertEquals("", StringUtils.join(list, ","));

    list.add("a");
    assertEquals("a", StringUtils.join(list, null));
    assertEquals("a", StringUtils.join(list, ","));

    list.add("xyzzy");
    assertEquals("axyzzy", StringUtils.join(list, null));
    assertEquals("a,xyzzy", StringUtils.join(list, ","));
    assertEquals("a-*-xyzzy", StringUtils.join(list, "-*-"));
}
 
View Full Code Here

    assertEquals("a{}b",
     StringUtils.replaceDelimited(null, "{", "}", r, "a{}b"));
}

public void testLineSplit() {
    ArrayList answer = new ArrayList();
    answer.add("");

    List split = StringUtils.splitIntoLines("");
    assertEquals(answer.size(), split.size());
    assertEquals(answer, split);

    // The three flavors of line endings
    String[] endings = { "\n", "\r", "\r\n" };

    // We want to see an array with one empty string (the text before the
    // newline). There is no string after the newline.
    for (int i = 0; i < endings.length; ++i) {
  split = StringUtils.splitIntoLines(endings[i]);
  assertEquals(answer.size(), split.size());
  assertEquals(answer, split);
    }

    answer.add("x");
    for (int i = 0; i < endings.length; ++i) {
  split = StringUtils.splitIntoLines(endings[i] + "x");
  assertEquals(answer.size(), split.size());
  assertEquals(answer, split);
    }

    answer = new ArrayList();
    answer.add("line one");
    answer.add("part deux");
    answer.add("three's a crowd, eh?");
    answer.add("");

    split = StringUtils.splitIntoLines("line one\npart deux\nthree's a crowd, eh?"
         + "\n\n");
    assertEquals(answer.size(), split.size());
    assertEquals(answer, split);

    // Test two newlines in a row
    answer = new ArrayList();
    answer.add("two newlines after this line");
    answer.add("");
    answer.add("part deux");
    answer.add("three's a crowd, eh?");
    answer.add("");

    split = StringUtils.splitIntoLines("two newlines after this line\n\npart deux\nthree's a crowd, eh?"
         + "\n\n");
    assertEquals(answer.size(), split.size());
    assertEquals(answer, split);

    split = StringUtils.splitIntoLines("two newlines after this line\r\n\r\npart deux\r\nthree's a crowd, eh?"
         + "\n\n");
    assertEquals(answer.size(), split.size());
    assertEquals(answer, split);

    split = StringUtils.splitIntoLines("two newlines after this line\r\rpart deux\rthree's a crowd, eh?"
         + "\r\r");
    assertEquals(answer.size(), split.size());
    assertEquals(answer, split);
}
View Full Code Here

    public void testVSynch() throws Exception
  {
    long start = System.currentTimeMillis();
    boolean running=true;
    List members=new ArrayList();     
   
    //first spawn and join
    for(int i =0;i<INITIAL_NUMBER_OF_MEMBERS;i++)
    {
      GroupMemberThread member = new GroupMemberThread("Member");
      member.start();     
      members.add(member);         
      Util.sleep(getRandomDelayInSeconds(4,6)*1000);
    }
   
   
    for (; running;) {           
     
      //and then flip a coin
      if(r.nextBoolean())
      {
        Util.sleep(getRandomDelayInSeconds(3,8)*1000);
        GroupMemberThread member = new GroupMemberThread("Member");       
        member.start();     
        members.add(member);       
      }
      else if(members.size()>1)
      {
        Util.sleep(getRandomDelayInSeconds(3,8)*1000);
        GroupMemberThread unluckyBastard = (GroupMemberThread) members.get(r.nextInt(members.size()));
        members.remove(unluckyBastard);       
        unluckyBastard.setRunning(false);       
      }       
      running =System.currentTimeMillis() - start <= runningTime;
      System.out.println("Running time " + ((System.currentTimeMillis()-start)/1000) + " secs");
    }
View Full Code Here

    Random r;
    int messagesSentPerView = 0;

    public GroupMemberThread(String name) {
      super(name);     
      payloads = new ArrayList();
      r = new Random();
      messagesSentPerView = r.nextInt(25);
    }
View Full Code Here

    /**
     * Creates a new MultiFilter.
     */
    public MultiFilter() {
        filterList = new ArrayList();
    }
View Full Code Here

     * grow automatically.
     *
     * @param initialCapacity an initial capacity size for the MultiFilter.
     */
    public MultiFilter(int initialCapacity) {
        filterList = new ArrayList(initialCapacity);
    }
View Full Code Here

TOP

Related Classes of java.util.ArrayList$ArrayListSpliterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.