

/*
 * Copyright (c) 2016, nwillc@gmail.com
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

package com.github.nwillc.jmeterout;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

import static com.github.nwillc.jmeterout.Stats.avg;
import static com.github.nwillc.jmeterout.Stats.percentile;

class RequestEntry {
    private final String url;
    int failures = 0;
    int threads = 0;
    final List<Integer> times = new LinkedList<>();

    RequestEntry(String url) {
        this.url = url;
    }

    @Override
    public String toString() {
        Collections.sort(times);
        return url + ", " +
                times.size() + ", " +
                times.get(0) + ", " +
                times.get(times.size() - 1) + ", " +
                avg(times) + ", " +
                percentile(times, 95) + ", " +
                failures + ", " +
                threads;
    }
}

@@ -1319,20 +1319,52 @@
 urn 
-url + 
+new StringBuilder().append(url).append(
 %22, %22
- +
+)
 %0A   
@@ -1372,24 +1372,32 @@
             
+.append(
 times.size()
@@ -1396,25 +1396,30 @@
 s.size()
- + 
+).append(
 %22, %22
- +
+)
 %0A       
@@ -1419,32 +1419,40 @@
                 
+.append(
 times.get(0) + %22
@@ -1447,25 +1447,30 @@
 s.get(0)
- + 
+).append(
 %22, %22
- +
+)
 %0A       
@@ -1478,16 +1478,24 @@
         
+.append(
 times.ge
@@ -1513,25 +1513,30 @@
 e() - 1)
- + 
+).append(
 %22, %22
- +
+)
 %0A       
@@ -1544,16 +1544,24 @@
         
+.append(
 avg(time
@@ -1562,25 +1562,30 @@
 g(times)
- + 
+).append(
 %22, %22
- +
+)
 %0A       
@@ -1593,16 +1593,24 @@
         
+.append(
 percenti
@@ -1622,25 +1622,30 @@
 mes, 95)
- + 
+).append(
 %22, %22
- +
+)
 %0A       
@@ -1657,25 +1657,38 @@
     
-failures + 
+.append(failures).append(
 %22, %22
- +
+)
 %0A   
@@ -1700,23 +1700,43 @@
         
-threads
+.append(threads).toString()
 ;%0A    %7D%0A

Use stringbuilder