/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/util/IntSet.java
ViewVC logotype

Contents of /android/TrainInfo/src/dk/thoerup/traininfo/util/IntSet.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 441 - (show annotations) (download)
Sun Oct 11 07:23:35 2009 UTC (14 years, 7 months ago) by torben
File size: 539 byte(s)
Simplify IntSet
1 package dk.thoerup.traininfo.util;
2
3
4 import java.util.TreeSet;
5
6 public class IntSet extends TreeSet<Integer> {
7
8
9 private static final long serialVersionUID = 1L;
10
11 public String toString() {
12 StringBuffer sb = new StringBuffer();
13
14 for (int i : this) {
15 if (sb.length() > 0) {
16 sb.append(",");
17 }
18 sb.append(i);
19 }
20
21 return sb.toString();
22 }
23
24 public void fromString(String intStr) {
25 this.clear();
26 String parts[] = intStr.split(",");
27 for (String istr : parts) {
28 this.add( Integer.parseInt(istr));
29 }
30 }
31
32 }

  ViewVC Help
Powered by ViewVC 1.1.20