Skip to content

Commit

Permalink
Stack is a thread-safe synchronized collection. (#696)
Browse files Browse the repository at this point in the history
When thread safety is not required it's better to use non-thread safe alternative ArrayDeque
  • Loading branch information
turbanoff authored Oct 14, 2021
1 parent f8c6bb7 commit 397e728
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions terminal/src/main/java/org/jline/utils/Curses.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.io.IOError;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Stack;
import java.util.ArrayDeque;

/**
* Curses helper methods.
Expand All @@ -21,8 +21,8 @@
*/
public final class Curses {

private static Object[] sv = new Object[26];
private static Object[] dv = new Object[26];
private static final Object[] sv = new Object[26];
private static final Object[] dv = new Object[26];

private static final int IFTE_NONE = 0;
private static final int IFTE_IF = 1;
Expand Down Expand Up @@ -68,7 +68,7 @@ private static void doTputs(Appendable out, String str, Object... params) throws
int length = str.length();
int ifte = IFTE_NONE;
boolean exec = true;
Stack<Object> stack = new Stack<>();
ArrayDeque<Object> stack = new ArrayDeque<>();
while (index < length) {
char ch = str.charAt(index++);
switch (ch) {
Expand Down

0 comments on commit 397e728

Please sign in to comment.