avoid string concat in a loop
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2014 JetBrains s.r.o.
|
* Copyright 2000-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -18,9 +18,8 @@ package org.jetbrains.java.decompiler.code.cfg;
|
|||||||
import org.jetbrains.java.decompiler.main.DecompilerContext;
|
import org.jetbrains.java.decompiler.main.DecompilerContext;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ExceptionRangeCFG {
|
public class ExceptionRangeCFG {
|
||||||
|
|
||||||
@@ -105,21 +104,7 @@ public class ExceptionRangeCFG {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> setExceptionStrings = new HashSet<>();
|
return exceptionTypes.stream().distinct().collect(Collectors.joining(":"));
|
||||||
|
|
||||||
for (String exceptionType : exceptionTypes) { // normalize order
|
|
||||||
setExceptionStrings.add(exceptionType);
|
|
||||||
}
|
|
||||||
|
|
||||||
String ret = "";
|
|
||||||
for (String exception : setExceptionStrings) {
|
|
||||||
if (!ret.isEmpty()) {
|
|
||||||
ret += ":";
|
|
||||||
}
|
|
||||||
ret += exception;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user