1 28 29 package org.objectweb.util.launcher ; 30 31 32 import java.util.ArrayList ; 33 import java.util.Arrays ; 34 import java.util.Collection ; 35 36 37 47 public class StringList 48 extends ArrayList 49 { 50 54 public StringList() { 55 super(); 56 } 57 58 62 public StringList(String [] str) { 63 super(Arrays.asList(str)); 64 } 65 66 71 public void add(String value) { 72 if (!value.trim().equals("")) 73 add((Object )value); 74 } 75 76 81 public void addAll(StringList value) { 82 addAll((Collection )value); 83 } 84 85 90 public String [] toStringArray() { 91 return (String []) toArray(new String [0]); 92 } 93 94 95 100 public String toString() { 101 java.util.Iterator iter = super.iterator(); 102 StringBuffer result = new StringBuffer (); 103 result.append("["); 104 while (iter.hasNext()) { 105 String value = (String ) iter.next() ; 106 result.append(value); 107 if (iter.hasNext()) result.append(", "); 108 } 109 result.append("]"); 110 return result.toString(); 111 } 112 113 120 public boolean equals(Object obj) { 121 if (obj instanceof StringList) { 122 StringList list = (StringList) obj; 123 return super.equals(obj); 124 } 125 return false ; 126 } 127 } | Popular Tags |