java-decompiler: minor optimization
This commit is contained in:
@@ -17,7 +17,10 @@ package org.jetbrains.java.decompiler.main;
|
||||
|
||||
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Allows to connect text with resulting lines
|
||||
@@ -172,4 +175,13 @@ public class TextBuffer {
|
||||
}
|
||||
myStringBuilder.insert(offset, s);
|
||||
}
|
||||
|
||||
public int count(String substring, int from) {
|
||||
int count = 0, length = substring.length(), p = from;
|
||||
while ((p = myStringBuilder.indexOf(substring, p)) > 0) {
|
||||
++count;
|
||||
p += length;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user