Skip to content

Commit 397e728

Browse files
authored
Stack is a thread-safe synchronized collection. (#696)
When thread safety is not required it's better to use non-thread safe alternative ArrayDeque
1 parent f8c6bb7 commit 397e728

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

terminal/src/main/java/org/jline/utils/Curses.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import java.io.IOError;
1313
import java.io.IOException;
1414
import java.io.StringWriter;
15-
import java.util.Stack;
15+
import java.util.ArrayDeque;
1616

1717
/**
1818
* Curses helper methods.
@@ -21,8 +21,8 @@
2121
*/
2222
public final class Curses {
2323

24-
private static Object[] sv = new Object[26];
25-
private static Object[] dv = new Object[26];
24+
private static final Object[] sv = new Object[26];
25+
private static final Object[] dv = new Object[26];
2626

2727
private static final int IFTE_NONE = 0;
2828
private static final int IFTE_IF = 1;
@@ -68,7 +68,7 @@ private static void doTputs(Appendable out, String str, Object... params) throws
6868
int length = str.length();
6969
int ifte = IFTE_NONE;
7070
boolean exec = true;
71-
Stack<Object> stack = new Stack<>();
71+
ArrayDeque<Object> stack = new ArrayDeque<>();
7272
while (index < length) {
7373
char ch = str.charAt(index++);
7474
switch (ch) {

0 commit comments

Comments
 (0)