1
2 package org.paneris.util;
3 import java.util.Enumeration;
4 import java.util.Vector;
5
6
7
8
9
10
11
12 public class JoinVector extends Vector {
13
14 private static final long serialVersionUID = 1L;
15
16
17
18
19 public JoinVector() {
20 super();
21 }
22
23
24
25
26 public JoinVector(int initialCapacity) {
27 super(initialCapacity);
28 }
29
30
31
32
33 public JoinVector(int initialCapacity, int capacityIncrement) {
34 super(initialCapacity, capacityIncrement);
35 }
36
37
38
39
40 public String join(String deliminator) {
41
42 String joined = new String();
43 for (Enumeration en = this.elements() ; en.hasMoreElements() ;) {
44 Object test = en.nextElement();
45 if (test instanceof String) {
46 joined = joined.concat((String)test + deliminator);
47 }
48 }
49 if (joined.lastIndexOf(deliminator) > 0) {
50 joined = joined.substring(0,joined.lastIndexOf(deliminator));
51 }
52 return joined;
53 }
54 }
55
56
57