1 12 package org.displaytag.sample; 13 14 import java.util.ArrayList ; 15 import java.util.Random ; 16 17 18 26 public class TestList extends ArrayList 27 { 28 29 32 private static final long serialVersionUID = 899149338534L; 33 34 37 public TestList() 38 { 39 super(); 40 41 for (int j = 0; j < 60; j++) 42 { 43 add(new ListObject()); 44 } 45 } 46 47 52 public TestList(int size, boolean duplicates) 53 { 54 if (duplicates) 55 { 56 for (int j = 0; j < size; j++) 58 { 59 60 ListObject object1 = new ListObject(); 61 ListObject object2 = new ListObject(); 62 ListObject object3 = new ListObject(); 63 64 int random = new Random ().nextInt(3); 65 for (int k = 0; k <= random; k++) 66 { 67 add(object1); 68 } 69 70 object1.setId(object2.getId()); 71 72 random = new Random ().nextInt(3); 73 for (int k = 0; k <= random; k++) 74 { 75 add(object1); 76 add(object2); 77 } 78 79 object1.setEmail(object3.getEmail()); 80 81 random = new java.util.Random ().nextInt(3); 82 for (int k = 0; k <= random; k++) 83 { 84 add(object1); 85 } 86 } 87 } 88 else 89 { 90 for (int j = 0; j < size; j++) 91 { 92 add(new ListObject()); 93 } 94 } 95 } 96 97 102 public ListObject getItem(int index) 103 { 104 return (ListObject) super.get(index); 105 } 106 107 } 108 | Popular Tags |