Skip to content

Commit b678fe1

Browse files
committed
Fix ordering for duplicated values
1 parent 7c76bce commit b678fe1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTargetExtensio
153153
private static final String LAMBDA_SEPARATOR = " "; //$NON-NLS-1$
154154
private static final int MAX_LAMBDA_LINE_LENGTH = 25;
155155
private static final int MAX_TOTAL_LAMBDA_LINE_LENGTH = MAX_LAMBDA_LINE_LENGTH * 2;
156+
private static final String ZERO_WIDTH_SPACE = "\u200B"; //$NON-NLS-1$
156157

157158
/**
158159
* Constructor
@@ -1968,7 +1969,12 @@ private static ICompilationUnit getCompilationUnit(ITextEditor editor) {
19681969
}
19691970

19701971
public int selectLambda(List<LambdaExpression> lambdaExps) {
1971-
List<String> lambdaNames = lambdaExps.stream().map(expr -> shortenLambdaExpression(expr.toString())).toList();
1972+
Map<String, Integer> seen = new HashMap<>();
1973+
List<String> lambdaNames = lambdaExps.stream().map(expr -> shortenLambdaExpression(expr.toString())).map(name -> {
1974+
int count = seen.getOrDefault(name, 0);
1975+
seen.put(name, count + 1);
1976+
return count == 0 ? name : name + ZERO_WIDTH_SPACE.repeat(count);
1977+
}).toList();
19721978
LambdaLabelProvider lambdaLabelProvider = new LambdaLabelProvider(lambdaExps, lambdaNames);
19731979
ElementListSelectionDialog dialog = new ElementListSelectionDialog(DebugUIPlugin.getShellForModalDialog(), lambdaLabelProvider) {
19741980
@Override

0 commit comments

Comments
 (0)