}
private String getStatus() {
- String s = "";
- for (int i = 0; i < Common.FILE_PIECES; i++) {
- s = s + bitfield[i];
- }
- return s;
+ StringBuilder s = new StringBuilder("");
+ for (int i = 0; i < Common.FILE_PIECES; i++)
+ s.append(bitfield[i]);
+ return s.toString();
}
}
public Answer(int destinationId) {
this.destinationId = destinationId;
- nodes = new ArrayList<Contact>();
+ nodes = new ArrayList<>();
}
int getDestinationId() {
public RoutingTable(int id) {
this.id = id;
- buckets = new Vector<Bucket>();
+ buckets = new Vector<>();
for (int i = 0; i < Common.IDENTIFIER_SIZE + 1; i++) {
buckets.add(new Bucket(i));
}
@Override
public String toString() {
- String string = "RoutingTable [ id=" + id + " " ;
+ StringBuilder string = new StringBuilder("RoutingTable [ id=" + id + " ");
for (int i = 0; i < buckets.size(); i++) {
if (buckets.get(i).size() > 0) {
- string += buckets.get(i) + " ";
+ string.append(buckets.get(i) + " ");
}
}
- return string;
+ return string.toString();
}
}