List of utility methods to do Deque Usage
void | addSegment(Deque add Segment outputBuffer.push(nextSegment); |
String | buildQueryString(final Map build Query String StringBuilder sb = new StringBuilder(); boolean first = true; for (Map.Entry<String, Deque<String>> entry : params.entrySet()) { if (entry.getValue().isEmpty()) { if (first) { first = false; } else { sb.append('&'); ... |
Deque>[] | createEmptyDequeArray(int size) create Empty Deque Array Deque<?>[] deque = new ArrayDeque<?>[size]; for (int i = 0; i < size; i++) deque[i] = new ArrayDeque<T>(); return deque; |
Deque | emptyDeque() empty Deque return EMPTY_DEQUE;
|
Deque | getArrayDeque() get Array Deque return new ArrayDeque<E>(); |
T | getLast(List get Last if (list instanceof Deque) { return ((Deque<T>) list).getLast(); return list.get(list.size() - 1); |
T | pop(Deque Pop the first object from a deque, if it exists. T o = def;
return deque.isEmpty() ? def : (o = deque.pop()) == null ? def : o;
|
void | removeLastTest(Deque remove Last Test Object firstObject = new Object(); Object lastObject = new Object(); q.addLast(firstObject); q.addLast(lastObject); verify(q.removeLast() == lastObject); verify(q.removeLast() == firstObject); |
List | splitWords(String text) split Words List<String> result = new ArrayList<>(); char[] chars = text.toCharArray(); int begin = 0; boolean word = false; for (int i = 0; i < chars.length; i++) { if (Character.isWhitespace(chars[i])) { if (word) { result.add(new String(chars, begin, i - begin)); ... |